1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _httpStatus = require('http-status');
|
8 |
|
9 | var _httpStatus2 = _interopRequireDefault(_httpStatus);
|
10 |
|
11 | var _ExtendableError2 = require('./ExtendableError');
|
12 |
|
13 | var _ExtendableError3 = _interopRequireDefault(_ExtendableError2);
|
14 |
|
15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16 |
|
17 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
18 |
|
19 | function _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; }
|
20 |
|
21 | function _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; }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var APIError = function (_ExtendableError) {
|
29 | _inherits(APIError, _ExtendableError);
|
30 |
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | function APIError(message) {
|
39 | var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _httpStatus2.default.INTERNAL_SERVER_ERROR;
|
40 | var isPublic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
41 |
|
42 | _classCallCheck(this, APIError);
|
43 |
|
44 | return _possibleConstructorReturn(this, (APIError.__proto__ || Object.getPrototypeOf(APIError)).call(this, message, status, isPublic));
|
45 | }
|
46 |
|
47 | return APIError;
|
48 | }(_ExtendableError3.default);
|
49 |
|
50 | exports.default = APIError;
|
51 | module.exports = exports['default'];
|
52 |
|