-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (39 loc) · 1.32 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _coolAsciiFaces = require('cool-ascii-faces');
var _coolAsciiFaces2 = _interopRequireDefault(_coolAsciiFaces);
var errorHandling = function errorHandling() {
return regeneratorRuntime.mark(function errorHandling(next) {
return regeneratorRuntime.wrap(function errorHandling$(context$2$0) {
while (1) switch (context$2$0.prev = context$2$0.next) {
case 0:
context$2$0.prev = 0;
context$2$0.next = 3;
return next;
case 3:
context$2$0.next = 9;
break;
case 5:
context$2$0.prev = 5;
context$2$0.t0 = context$2$0['catch'](0);
this.status = context$2$0.t0.status ? context$2$0.t0.status : 500;
this.body = {
error: {
status: this.status,
name: context$2$0.t0.name,
path: this.request.originalUrl,
reaction: (0, _coolAsciiFaces2['default'])()
}
};
case 9:
case 'end':
return context$2$0.stop();
}
}, errorHandling, this, [[0, 5]]);
});
};
exports['default'] = errorHandling;
module.exports = exports['default'];