Skip to main content
An error that is thrown when the API call was not successful

Extends

Constructors

Constructor

new ApiError(status, error, response): ApiError

Parameters

status
number
error
unknown
response
Response

Returns

ApiError

Overrides

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 | undefined
Returns the parsed error response body with its known type, or undefined if the body doesn’t match the expected shape. The HoneyHive API returns { statusCode, message, success, errorCode } as JSON for all error responses. However, failures that happen before a request reaches the API (e.g. an HTML 502 from a load balancer, or a generic 404) can arrive in an unrecognized shape, in which case we return undefined.

Returns

ErrorResponse | undefined