Skip to main content
The Reducto Go SDK uses standard Go error handling patterns with a specific *reducto.Error type for API errors.

Error Handling

All SDK methods return errors following Go conventions:

API Error Type

When the API returns a non-success status code, the SDK returns a *reducto.Error:
The *reducto.Error type contains:
  • StatusCode: HTTP status code
  • *http.Request: The request that failed
  • *http.Response: The response received
  • DumpRequest(): Serialize the HTTP request for debugging
  • DumpResponse(): Serialize the HTTP response for debugging

Error Status Codes

Common status codes:
  • 400: Bad Request - Invalid parameters
  • 401: Authentication Error - Invalid or missing API key
  • 403: Permission Denied - Insufficient permissions
  • 404: Not Found - Resource doesn’t exist
  • 422: Unprocessable Entity - Validation error
  • 429: Rate Limit - Too many requests
  • 500+: Internal Server Error - Server-side issue

Automatic Retries

The SDK automatically retries requests on:
  • Connection errors
  • 408 Request Timeout
  • 409 Conflict
  • 429 Rate Limit
  • 5xx Internal Server Errors
Default retry count is 2, configurable via option.WithMaxRetries:

Manual Retry Logic

For custom retry logic:

Timeouts

Use context for request timeouts:

Next Steps