UNPKG

@webbio/viper-core-utils

Version:

Webbio's error interface which is used in the Viper Project

32 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const baseError_1 = tslib_1.__importDefault(require("./baseError")); const sentry_logger_1 = tslib_1.__importDefault(require("./sentry.logger")); class HttpError extends baseError_1.default { /** * A HTTP Error which can be returned to the client as response * @param name Name of the error * @param message A descriptive message of the http error * @param responseCode The HTTP response code */ constructor(name, message, responseCode) { super(new sentry_logger_1.default(), name, message); this.responseCode = responseCode; this.report(); } /** * Retrieve the HTTP response code of the error */ getResponseCode() { return this.responseCode; } /** * Report the error to Sentry */ report() { super.report(); } } exports.default = HttpError; //# sourceMappingURL=httpError.js.map