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 Summary)

Constructors

  • Construct a Matrix error. This is a JavaScript Error with additional information specific to the standard Matrix error response.

    Parameters

    • errorJson: IErrorJson = {}

      The Matrix error JSON returned from the homeserver.

    • OptionalhttpStatus: number

      The numeric HTTP status code given

    • Optionalurl: string
    • Optionalevent: MatrixEvent
    • OptionalhttpHeaders: Headers

      The HTTP response headers given

    Returns MatrixError

Properties

errcode?: string
event?: MatrixEvent
httpHeaders?: Headers
httpStatus?: number
url?: string

Methods

  • Returns IMatrixApiError

    this error expressed as a JSON payload for use by Widget API error responses.

  • 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.