TryCatch improved error handling and formatting.