Skip to content

Function: isErrorCode()

ts
function isErrorCode(error, code): boolean;

Defined in: src/errors.ts:244

Whether error is a server error response carrying the given machine-readable code.

Escape hatch: prefer instanceof on the condition subclasses. Also matches on .message for non-ResponseError errors, preserving legacy error.message === "code" semantics.

Parameters

ParameterType
errorunknown
codeResponseErrorCode

Returns

boolean