# OvokException

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

```java
public class OvokException extends RuntimeException
```

Base class of every exception the SDK throws; carries the API's error details when there is a response.

## Constructors [#constructors]

### OvokException [#ovokexception]

```java
public OvokException(String message)
```

Creates an exception with only a message.

**Parameters:**

- `message`: the error message

```java
public OvokException(
        String message,
        Integer status,
        String code,
        String type,
        String traceId,
        String requestId,
        Duration retryAfter,
        String body,
        Throwable cause)
```

Creates an exception with the API's error details.

**Parameters:**

- `message`: the error message
- `status`: the HTTP status, or `null`
- `code`: the error code from the response body, or `null`
- `type`: the error type from the response body, or `null`
- `traceId`: the `x-trace-id` response header, or `null`
- `requestId`: the `x-request-id` response header, or `null`
- `retryAfter`: the `Retry-After` delay, or `null`
- `body`: the raw response body, or `null`
- `cause`: the underlying cause, or `null`

## Methods [#methods]

### status [#status]

```java
public Integer status()
```

Returns the HTTP status.

**Returns:** the status, or `null` when there was no response

### code [#code]

```java
public String code()
```

Returns the error code from the response body.

**Returns:** the code, or `null`

### type [#type]

```java
public String type()
```

Returns the error type from the response body.

**Returns:** the type, or `null`

### traceId [#traceid]

```java
public String traceId()
```

Returns the `x-trace-id` response header, for support requests.

**Returns:** the trace id, or `null`

### requestId [#requestid]

```java
public String requestId()
```

Returns the `x-request-id` response header, for support requests.

**Returns:** the request id, or `null`

### retryAfter [#retryafter]

```java
public Duration retryAfter()
```

Returns how long to wait before retrying, from the `Retry-After` header.

**Returns:** the delay, or `null` when the response did not set one

### body [#body]

```java
public String body()
```

Returns the raw response body.

**Returns:** the body, or `null`
