# Ovok exception

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/ovok-exception

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## OvokAuthenticationException [#ovokauthenticationexception]

```dart
class OvokAuthenticationException extends OvokException
```

401.

### Constructors [#constructors]

#### OvokAuthenticationException.new [#ovokauthenticationexceptionnew]

```dart
OvokAuthenticationException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokConfigException [#ovokconfigexception]

```dart
class OvokConfigException extends OvokException
```

A bad option, or an action this client cannot take.

### Constructors [#constructors-1]

#### OvokConfigException.new [#ovokconfigexceptionnew]

```dart
OvokConfigException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokConflictException [#ovokconflictexception]

```dart
class OvokConflictException extends OvokException
```

409.

### Constructors [#constructors-2]

#### OvokConflictException.new [#ovokconflictexceptionnew]

```dart
OvokConflictException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokConnectionException [#ovokconnectionexception]

```dart
class OvokConnectionException extends OvokException
```

No answer: a network failure or a timeout.

### Constructors [#constructors-3]

#### OvokConnectionException.new [#ovokconnectionexceptionnew]

```dart
OvokConnectionException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokErrorDetails [#ovokerrordetails]

```dart
class OvokErrorDetails
```

What an [`OvokException`](#ovokexception) carries; every field but [`message`](#ovokerrordetailsmessage) may be unknown.

### Constructors [#constructors-4]

#### OvokErrorDetails.new [#ovokerrordetailsnew]

```dart
OvokErrorDetails({
  required String message,
  int? status,
  String? code,
  String? type,
  String? traceId,
  String? requestId,
  int? retryAfterMs,
  List<OvokFieldError> fieldErrors = const [],
})
```

Creates the details; the SDK builds these from error responses.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `message` | `String` | required named |  |
| `status` | `int?` | named |  |
| `code` | `String?` | named |  |
| `type` | `String?` | named |  |
| `traceId` | `String?` | named |  |
| `requestId` | `String?` | named |  |
| `retryAfterMs` | `int?` | named |  |
| `fieldErrors` | `List<OvokFieldError>` | named | `const []` |

### Properties [#properties]

#### OvokErrorDetails.message [#ovokerrordetailsmessage]

```dart
final String message
```

A human-readable description of the failure.

#### OvokErrorDetails.status [#ovokerrordetailsstatus]

```dart
final int? status
```

The HTTP status; null when no response arrived.

#### OvokErrorDetails.code [#ovokerrordetailscode]

```dart
final String? code
```

The condition the server named; null when only the status is known.

#### OvokErrorDetails.type [#ovokerrordetailstype]

```dart
final String? type
```

The problem type URI, `https://docs.ovok.com/errors/<code>`.

#### OvokErrorDetails.traceId [#ovokerrordetailstraceid]

```dart
final String? traceId
```

The trace ID from `x-trace-id` or the body.

#### OvokErrorDetails.requestId [#ovokerrordetailsrequestid]

```dart
final String? requestId
```

The request ID from `x-request-id` or the body.

#### OvokErrorDetails.retryAfterMs [#ovokerrordetailsretryafterms]

```dart
final int? retryAfterMs
```

How long to wait before retrying, from `Retry-After` or the body.

#### OvokErrorDetails.fieldErrors [#ovokerrordetailsfielderrors]

```dart
final List<OvokFieldError> fieldErrors
```

The fields the server rejected.


## OvokException [#ovokexception]

```dart
class OvokException implements Exception
```

Every failure the SDK reports; catch a subclass to handle one case.

### Constructors [#constructors-5]

#### OvokException.new [#ovokexceptionnew]

```dart
OvokException(OvokErrorDetails details, {Object? cause})
```

Creates an exception from `details`; [`cause`](#ovokexceptioncause) is the underlying error, if any.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |

### Properties [#properties-1]

#### OvokException.message [#ovokexceptionmessage]

```dart
final String message
```

A human-readable description of the failure.

#### OvokException.status [#ovokexceptionstatus]

```dart
final int? status
```

The HTTP status; null when no response arrived.

#### OvokException.code [#ovokexceptioncode]

```dart
final String? code
```

The condition the server named; null when only the status is known.

#### OvokException.type [#ovokexceptiontype]

```dart
final String? type
```

The problem type URI, `https://docs.ovok.com/errors/<code>`.

#### OvokException.traceId [#ovokexceptiontraceid]

```dart
final String? traceId
```

Quote it when reporting a problem.

#### OvokException.requestId [#ovokexceptionrequestid]

```dart
final String? requestId
```

The request ID from `x-request-id` or the body.

#### OvokException.retryAfterMs [#ovokexceptionretryafterms]

```dart
final int? retryAfterMs
```

How long to wait before retrying, from `Retry-After` or the body.

#### OvokException.fieldErrors [#ovokexceptionfielderrors]

```dart
final List<OvokFieldError> fieldErrors
```

The fields the server rejected; empty when none were named.

#### OvokException.cause [#ovokexceptioncause]

```dart
final Object? cause
```

The underlying error, such as a timeout or socket failure.


## OvokFieldError [#ovokfielderror]

```dart
class OvokFieldError
```

One field the server rejected; [`path`](#ovokfielderrorpath) is the field's location, outermost first.

### Constructors [#constructors-6]

#### OvokFieldError.new [#ovokfielderrornew]

```dart
OvokFieldError({
  required String message,
  List<String> path = const [],
  String? code,
  String? validation,
})
```

Creates a field error; the SDK builds these from error responses.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `message` | `String` | required named |  |
| `path` | `List<String>` | named | `const []` |
| `code` | `String?` | named |  |
| `validation` | `String?` | named |  |

### Properties [#properties-2]

#### OvokFieldError.message [#ovokfielderrormessage]

```dart
final String message
```

Why the field was rejected.

#### OvokFieldError.path [#ovokfielderrorpath]

```dart
final List<String> path
```

The field's location, outermost first; empty when the server named none.

#### OvokFieldError.code [#ovokfielderrorcode]

```dart
final String? code
```

The rejection's code, when the server sent one.

#### OvokFieldError.validation [#ovokfielderrorvalidation]

```dart
final String? validation
```

The kind of validation that failed, when the server named it.


## OvokNotFoundException [#ovoknotfoundexception]

```dart
class OvokNotFoundException extends OvokException
```

404.

### Constructors [#constructors-7]

#### OvokNotFoundException.new [#ovoknotfoundexceptionnew]

```dart
OvokNotFoundException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokPermissionException [#ovokpermissionexception]

```dart
class OvokPermissionException extends OvokException
```

403: signed in, but not allowed.

### Constructors [#constructors-8]

#### OvokPermissionException.new [#ovokpermissionexceptionnew]

```dart
OvokPermissionException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokRateLimitException [#ovokratelimitexception]

```dart
class OvokRateLimitException extends OvokException
```

429.

### Constructors [#constructors-9]

#### OvokRateLimitException.new [#ovokratelimitexceptionnew]

```dart
OvokRateLimitException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokServiceException [#ovokserviceexception]

```dart
class OvokServiceException extends OvokException
```

5xx.

### Constructors [#constructors-10]

#### OvokServiceException.new [#ovokserviceexceptionnew]

```dart
OvokServiceException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |


## OvokValidationException [#ovokvalidationexception]

```dart
class OvokValidationException extends OvokException
```

400 or 422.

### Constructors [#constructors-11]

#### OvokValidationException.new [#ovokvalidationexceptionnew]

```dart
OvokValidationException(OvokErrorDetails details, {Object? cause})
```

Creates the exception from `details`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `details` | `OvokErrorDetails` | positional |  |
| `cause` | `Object?` | named |  |
