class IsapiError
extends Error

A failed ISAPI request: a status outside 2xx, a failing <ResponseStatus> in the body, or both.

Every field is optional because devices report failures either way. Branch on subStatusCode for the reason (notSupport, badAuthorization, …) and on httpStatus for the transport.

Examples

Build an error from a failing body

import { assertEquals } from "@std/assert";
import { IsapiError } from "./isapi-error.ts";

const error = new IsapiError({
  httpStatus: 403,
  status: { statusCode: 4, subStatusCode: "notSupport" },
});

assertEquals(error.subStatusCode, "notSupport");
assertEquals(error.message, "ISAPI request failed: HTTP 403, 4 notSupport");

Constructors

IsapiError(failure: IsapiFailure)
Parameters

What is known about the failure.

Properties

readonly
optional
httpStatus: number

The HTTP status, when outside 2xx.

readonly
optional
statusCode: number

The <statusCode> of the body, when it was a <ResponseStatus>.

readonly
optional
statusString: string

The <statusString> of the body, such as Invalid Operation.

readonly
optional
subStatusCode: string

The <subStatusCode> of the body, such as notSupport.

readonly
optional
url: string

The URL that was requested, or the <requestURL> the device named.