UNPKG

@donation-alerts/api-call

Version:
47 lines 1.5 kB
import { CustomError } from '@donation-alerts/common'; /** * Represents an HTTP-related error. * * @remarks * This error is thrown whenever an HTTP request encounters a non-successful HTTP status code. * It includes detailed information about the request, including the status code, status text, * URL, HTTP method, and response body. * * The `HttpError` class masks lengthy non-JSON response bodies for readability * in the error message. */ export declare class HttpError extends CustomError { private readonly _status; private readonly _statusText; private readonly _url; private readonly _method; private readonly _body; /** @internal */ constructor(_status: number, _statusText: string, _url: string, _method: string, _body: string, isJson: boolean); /** * The HTTP status code of the error. */ get status(): number; /** * The HTTP status text associated with the error. */ get statusText(): string; /** * The URL of the request that caused the error. */ get url(): string; /** * The HTTP method used in the request. */ get method(): string; /** * The response body of the request. * * @remarks * If the response body was excessively long (and not JSON), it might be truncated * in the error message for readability. Use this property to access the full * response body if needed. */ get body(): string; } //# sourceMappingURL=http.error.d.ts.map