Error handling
The SDK throws custom unchecked exception types:-
TelnyxServiceException: Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: -
TelnyxIoException: I/O networking errors. -
TelnyxRetryableException: Generic error indicating a failure that could be retried by the client. -
TelnyxInvalidDataException: Failure to interpret successfully parsed data. For example, when accessing a property that’s supposed to be required, but the API unexpectedly omitted it from the response. -
TelnyxException: Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.
Retries
The SDK automatically retries 2 times by default, with a short exponential backoff between requests. Only the following error types are retried:- Connection errors (for example, due to a network connectivity problem)
- 408 Request Timeout
- 409 Conflict
- 429 Rate Limit
- 5xx Internal
maxRetries method:
Timeouts
Requests time out after 1 minute by default. To set a custom timeout, configure the method call using thetimeout method: