Skip to main content

Exceptions

The Graphora client library defines custom exceptions for error handling. This page provides a reference for all the exceptions used in the library.

Exception Hierarchy

The exceptions in the Graphora client library follow a hierarchical structure:

GraphoraError

Base exception for all Graphora errors.
This is the parent class for all Graphora-specific exceptions. It inherits from Python’s built-in Exception class.

Example

GraphoraClientError

Exception raised for client-side errors.
This exception is raised when an error occurs on the client side, such as:
  • Invalid input parameters
  • Network connectivity issues
  • Timeout errors
  • JSON parsing errors

Example

GraphoraAPIError

Exception raised for API errors.
This exception is raised when the Graphora API returns an error response, such as:
  • Authentication errors
  • Authorization errors
  • Resource not found
  • Validation errors
  • Server errors

Properties

Example

Error Handling Best Practices

Here are some best practices for handling errors in the Graphora client library:

Catch Specific Exceptions

Catch specific exceptions rather than catching all exceptions:

Use Status Codes for API Errors

For GraphoraAPIError, use the status code to determine the appropriate action:

Implement Retry Logic

For transient errors, implement retry logic with exponential backoff:

Log Errors

Log errors for debugging and monitoring:

Complete Error Handling Example

Here’s a complete example of error handling in the Graphora client library:

Next Steps