# Errors and retries

Canonical page: https://docs.ovok.com/java-sdk/errors-and-retries

## Errors [#errors]

SDK errors extend `OvokException`, an unchecked exception. A response that is not a success throws an `OvokApiException` subtype:

| Status | Exception |
| --- | --- |
| 400, 422 | `OvokValidationException` |
| 401 | `OvokAuthenticationException` |
| 403 | `OvokPermissionException` |
| 404 | `OvokNotFoundException` |
| 409 | `OvokConflictException` |
| 429 | `OvokRateLimitException` |
| 5xx | `OvokServiceException` |

Other statuses throw `OvokApiException`. Read `status()`, `code()`, `type()`, `traceId()`, `requestId()`, `retryAfter()`, and `body()` from the exception.

A network failure throws `OvokConnectionException`, and an invalid configuration throws `OvokConfigException`. SDK methods also declare `IOException` and `InterruptedException`.

## Request options [#request-options]

Most methods have an overload that takes `RequestOptions`. Set a timeout for one request with `new RequestOptions(Duration.ofSeconds(5))`; `RequestOptions.defaults()` uses the configured timeout.

## Retries [#retries]

Idempotent requests retry transient failures up to `maxNetworkRetries` times and honor `Retry-After`. An authenticated request that answers 401 refreshes its token once and retries.
