Error Handling

The SDK defines custom exceptions to handle API errors.

The SDK defines custom exceptions to handle API errors.

  • t2g_sdk.exceptions.T2GException: The base exception for all API-related errors.
  • t2g_sdk.exceptions.APIError: Raised for general API errors.
  • t2g_sdk.exceptions.AuthenticationError: Raised for authentication-related errors (e.g., invalid API key).
  • t2g_sdk.exceptions.JobError: Raised when a job fails.

Recommendation

It is recommended to wrap your API calls in a try...except block to handle these exceptions.