UNPKG

@exceptionless/fetchclient

Version:

A simple fetch client with middleware support for Deno and the browser.

52 lines (51 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProblemDetails = void 0; /** * Represents a problem details object. */ 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; } } exports.ProblemDetails = ProblemDetails;