> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ApiError

> Handle ApiError from the HoneyHive TypeScript SDK when API calls return non-success HTTP status codes, including status, message, and response details.

An error that is thrown when the API call was not successful

## Extends

* [`HoneyHiveError`](/v2/sdk-reference/typescript/ref/classes/HoneyHiveError)

## Constructors

### Constructor

> **new ApiError**(`status`, `error`, `response`): `ApiError`

#### Parameters

##### status

`number`

##### error

`unknown`

##### response

`Response`

#### Returns

`ApiError`

#### Overrides

[`HoneyHiveError`](/v2/sdk-reference/typescript/ref/classes/HoneyHiveError).[`constructor`](/v2/sdk-reference/typescript/ref/classes/HoneyHiveError#constructor)

### error

> `readonly` **error**: `unknown`

***

### response

> `readonly` **response**: `Response`

The Response object from the fetch call. Call
`await err.response.text()` to see details of the error.

***

### status

> `readonly` **status**: `number`

The HTTP status code of the response

### parseError()

> **parseError**(): [`ErrorResponse`](/v2/sdk-reference/typescript/ref/classes/ErrorResponse) | `undefined`

Returns the parsed error response body with its known type, or `undefined`
if the body doesn't match the expected shape.

The server's errorResponseHandler middleware always returns `{ statusCode,
message, success, errorCode }` as JSON for all error responses. However,
non-application errors (e.g. a load balancer HTML 502, or Express's default
404\) can bypass that middleware and pass us an unknown shape, in which case
we return undefined.

#### Returns

[`ErrorResponse`](/v2/sdk-reference/typescript/ref/classes/ErrorResponse) | `undefined`

***
