Construct a generic HTTP error. This is a JavaScript Error with additional information specific to HTTP responses.

The error message to include.

The HTTP response status code.

The HTTP response headers.

Hierarchy (view full)

Constructors

Properties

httpHeaders?: Headers
httpStatus?: number

Methods

  • Returns null | number

    The recommended delay in milliseconds to wait before retrying the request that triggered this error, or null if no delay is recommended.

    Error if the recommended delay is an invalid value.

    safeGetRetryAfterMs for a version of this check that doesn't throw.

  • Check if this error was due to rate-limiting on the server side (and should therefore be retried after a delay).

    If this returns true, getRetryAfterMs can be called to retrieve the server-side recommendation for the retry period.

    Returns boolean

    Whether this error is due to rate-limiting.