Overview
Monzoh provides a comprehensive hierarchy of exception types to help you handle different error conditions that can occur when interacting with the Monzo API. All exceptions inherit from the baseMonzoError
class.
Exception Hierarchy
Base Exception
MonzoError
The base exception class that all other Monzoh exceptions inherit from.message
: Human-readable error messageresponse_data
: Raw API response data (if available)status_code
: HTTP status code (if applicable)
Network and Connection Errors
MonzoNetworkError
Raised when network connectivity issues occur.- No internet connection
- DNS resolution failures
- Connection timeouts
- SSL/TLS handshake failures
- Proxy connection issues
Authentication Errors
MonzoAuthenticationError
Raised when authentication fails.- Expired access token with invalid refresh token
- Revoked access token
- Invalid OAuth2 credentials
- Missing authentication headers
- Insufficient permissions for the requested operation
Request Validation Errors
MonzoValidationError
Raised when request parameters fail validation.- Invalid parameter formats (e.g., malformed account IDs)
- Missing required parameters
- Parameter values out of allowed range
- Invalid data types
- Malformed request structure
HTTP Status Code Errors
MonzoBadRequestError
Raised for HTTP 400 Bad Request errors.- Malformed request data
- Invalid parameter combinations
- Business logic violations
- Conflicting request parameters
- Invalid request format
MonzoNotFoundError
Raised when requested resources don’t exist (HTTP 404).- Invalid or non-existent resource IDs
- Resources that have been deleted
- Attempting to access resources you don’t have permission for
- Incorrect endpoint URLs
MonzoRateLimitError
Raised when API rate limits are exceeded (HTTP 429).- Making too many requests in a short time period
- Exceeding daily/hourly request quotas
- Multiple clients using the same credentials
- Automated scripts making frequent requests
MonzoServerError
Raised for server-side errors (HTTP 5xx).- Temporary API server issues
- Database connectivity problems on Monzo’s side
- Internal server errors
- Service maintenance or outages