UNPKG

@scayle/storefront-core

Version:

Collection of essential utilities to work with the Storefront API

50 lines (49 loc) 1.55 kB
/** * Interface representing details of an error response. Conforms to RFC 7807. * * @see https://datatracker.ietf.org/doc/html/rfc7807 */ interface ErrorResponseDetails { /** * A human-readable explanation specific to this occurrence of the problem. */ detail?: string; /** * A URI reference that identifies the specific occurrence of the problem. */ instance?: string; /** * A URI reference that identifies the general problem type. */ type?: string; /** * Allows for additional properties as needed. */ [s: string]: unknown | undefined; } /** * Error response based on RFC 9457 (Problem Details for HTTP APIs). * Extends the standard Response object to include structured error information. * * @see https://datatracker.ietf.org/doc/html/rfc9457 */ export declare class ErrorResponse extends Response { /** * A short, human-readable summary of the problem type. SHOULD NOT change from occurrence to occurrence of the problem. */ title: string; /** * Additional details about the error. */ details?: ErrorResponseDetails; /** * Creates a new ErrorResponse. * * @param statusCode The HTTP status code. * @param statusMessage The HTTP status message. * @param title A short, human-readable summary of the problem type. * @param detail Optional details about the error. */ constructor(statusCode: number, statusMessage: string, title: string, detail?: ErrorResponseDetails); } export {};