ractogateway.exceptions
Unified exception hierarchy for RactoGateway.
All provider-specific SDK errors (openai.APITimeoutError,
anthropic.APITimeoutError, google.api_core.exceptions.*, etc.) are
caught by the adapters and re-raised as one of these classes so callers
never need to import provider packages just to handle errors.
Example:
from ractogateway.exceptions import RactoGatewayTimeoutError
try:
response = kit.chat(config)
except RactoGatewayTimeoutError:
# Retry or surface a user-friendly message.
...
- exception ractogateway.exceptions.RactoGatewayError[source]
Bases:
ExceptionBase class for every RactoGateway runtime error.
- exception ractogateway.exceptions.RactoGatewayTimeoutError[source]
Bases:
RactoGatewayErrorThe upstream provider did not respond within the allowed time.
- exception ractogateway.exceptions.RactoGatewayAPIError(message, *, status_code=None)[source]
Bases:
RactoGatewayErrorThe upstream provider returned an error response.
- status_code
HTTP status code returned by the provider, when available.
- exception ractogateway.exceptions.RactoGatewayAuthError[source]
Bases:
RactoGatewayErrorAPI key missing, invalid, or not authorised for the requested resource.
- exception ractogateway.exceptions.ResponseModelValidationError(message, *, attempts, last_error, raw_response=None)[source]
Bases:
RactoGatewayErrorRaised when
response_modelvalidation cannot be satisfied.The LLM returned structurally valid JSON but Pydantic rejected it (e.g. a field value was out of range) and all automatic retry attempts were exhausted.
- attempts
Total number of API calls made (1 initial + N retries).
- last_error
The final
pydantic.ValidationErrorthat triggered this exception.
- raw_response
The LLM’s raw text from the last attempt, available for inspection or manual recovery.
- Example::
from ractogateway.exceptions import ResponseModelValidationError
- try:
response = kit.chat(config)
- except ResponseModelValidationError as e:
print(e.last_error) # Pydantic ValidationError details print(e.raw_response) # raw JSON string from the LLM print(e.attempts) # how many times we tried