UNPKG

@foundatiofx/fetchclient

Version:

A typed JSON fetch client with middleware support for Deno, Node and the browser.

48 lines (47 loc) 1.08 kB
/** * Represents a problem details object. */ export class ProblemDetails { /** * The type of the problem details. */ type; /** * The title of the problem details. */ title; /** * The HTTP status code of the problem details. */ status; /** * Additional details about the problem. */ detail; /** * The URI of the specific occurrence of the problem. */ instance; /** * Represents the errors associated with a problem details response. */ errors = {}; /** * Clears the error with the specified name. * @param name - The name of the error to clear. * @returns The updated ProblemDetails instance. */ clear(name) { delete this.errors[name]; return this; } /** * Sets the error message for the general error. * @param message - The error message to set. * @returns The updated ProblemDetails instance. */ setErrorMessage(message) { this.errors.general = [message]; return this; } }