Documentation ¶
Overview ¶
http_error_handling.go This package provides utility functions and structures for handling and categorizing HTTP error responses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleAPIError ¶
HandleAPIError handles error responses from the API, converting them into a structured error if possible.
func IsNonRetryableError ¶
IsNonRetryableError checks if the provided response indicates a non-retryable error.
func IsRateLimitError ¶
IsRateLimitError checks if the provided response indicates a rate limit error.
func IsTransientError ¶
IsTransientError checks if an error or HTTP response indicates a transient error.
func TranslateStatusCode ¶
TranslateStatusCode provides a human-readable message for HTTP status codes.
Types ¶
type APIError ¶
type APIError struct { StatusCode int // HTTP status code Type string // A brief identifier for the type of error (e.g., "RateLimit", "BadRequest", etc.) Message string // Human-readable message }
APIError represents a structured API error response.
type StructuredError ¶
type StructuredError struct { Error struct { Code string `json:"code"` Message string `json:"message"` } `json:"error"` }
StructuredError represents a structured error response from the API.