Handling errors
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass ofAPIError will be thrown:
Retries
Certain errors will be automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default. You can use themaxRetries option to configure or disable this:
Timeouts
Requests time out after 1 minute by default. You can configure this with atimeout option:
APIConnectionTimeoutError is thrown.
Note that requests which time out will be retried twice by default.