UNPKG

1.83 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
9function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10
11function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
12
13/**
14 * @extends Error
15 */
16
17var ExtendableError = function (_Error) {
18 _inherits(ExtendableError, _Error);
19
20 function ExtendableError(message, status, isPublic) {
21 _classCallCheck(this, ExtendableError);
22
23 var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message));
24
25 _this.name = _this.constructor.name;
26 _this.message = message;
27 _this.status = status;
28 _this.isPublic = isPublic;
29 _this.isOperational = true; // This is required since bluebird 4 doesn't append it anymore.
30 Error.captureStackTrace(_this, _this.constructor.name);
31 return _this;
32 }
33
34 return ExtendableError;
35}(Error);
36
37exports.default = ExtendableError;
38module.exports = exports['default'];
39//# sourceMappingURL=ExtendableError.js.map