@speedup/error
Version:
SpeedUP standard error library
38 lines (37 loc) • 1.39 kB
JavaScript
;
/**
* HTTP error
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var error_base_1 = require("./error_base");
var HttpError = /** @class */ (function (_super) {
__extends(HttpError, _super);
function HttpError(config) {
var _this =
// parent class constructor
_super.call(this, config) || this;
_this.statusCode = config.statusCode;
_this.statusMessage = config.statusMessage;
_this.isHandled = config.isHandled;
// set stacktrace
Error.captureStackTrace(_this, HttpError);
// Set prototype to make instanceOf enabled
Object.setPrototypeOf(_this, HttpError.prototype);
return _this;
}
return HttpError;
}(error_base_1.ErrorBase));
exports.HttpError = HttpError;