Skip to main content

Module error_handling

Module error_handling 

Source
Expand description

Centralized error handling for LLM providers Eliminates duplicate error handling code across providers

Constants§

STATUS_BAD_REQUEST
STATUS_FORBIDDEN
STATUS_TOO_MANY_REQUESTS
STATUS_UNAUTHORIZED
HTTP status codes for common error types

Functions§

extract_human_error_message
Extract the most human-readable error message from a provider’s JSON error body.
format_http_error
Format HTTP error with status code and message
format_network_error
Handle network errors with consistent formatting
format_parse_error
Handle JSON parsing errors with consistent formatting
handle_anthropic_http_error
Handle HTTP response errors for Anthropic provider
handle_gemini_http_error
Handle HTTP response errors for Gemini provider
handle_openai_http_error
Handle HTTP response errors for OpenAI-compatible providers
is_rate_limit_error
Check if an error is a rate limit error based on status code and message
parse_api_error
Parse standard API error response body into LLMError.