ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Error thrown when an HTTP response has a non-2xx status. Carries the numeric status so callers can branch on it (e.g. retrying a 403 WAF cookie challenge) rather than string-matching the message.

    The HTTP status code (e.g. 403)

    The HTTP status text (e.g. "Forbidden")

    The HttpError instance

    try {
    await fetchDecorator(url);
    } catch (error) {
    if (error instanceof HttpError && error.status === 403) {
    // retry the request
    }
    }
    export class HttpError extends Error {
    public readonly status: number;
    public readonly statusText: string;
    constructor(status: number, statusText: string) {
    super(`HTTP Error: ${status} ${statusText}`);
    this.name = "HttpError";
    this.status = status;
    this.statusText = statusText;
    }
    }

    Hierarchy

    Index

    Constructors

    Properties

    Constructors

    Properties

    status: number
    statusText: string