@driveflux/reporter 6.0.4-next.2 → 6.0.4-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +35 -43
- package/dist/drivers/console.js +194 -13
- package/dist/drivers/rollbar.js +207 -16
- package/dist/drivers/slack.js +340 -117
- package/dist/index.js +372 -67
- package/dist/types.js +1 -2
- package/package.json +8 -8
package/dist/config.js
CHANGED
|
@@ -1,80 +1,72 @@
|
|
|
1
1
|
import { ProblemSeverity } from '@driveflux/problem';
|
|
2
2
|
import { initSingleton } from '@driveflux/singleton';
|
|
3
3
|
import z from 'zod';
|
|
4
|
-
export
|
|
5
|
-
.object({
|
|
4
|
+
export var ConfigValidation = z.object({
|
|
6
5
|
isProd: z.boolean(),
|
|
7
6
|
deferReporting: z.boolean(),
|
|
8
|
-
slack: z
|
|
9
|
-
.object({
|
|
7
|
+
slack: z.object({
|
|
10
8
|
errorChannelId: z.string(),
|
|
11
9
|
token: z.string(),
|
|
12
|
-
minimumSeverity: z.enum(ProblemSeverity)
|
|
13
|
-
})
|
|
14
|
-
.optional(),
|
|
10
|
+
minimumSeverity: z.enum(ProblemSeverity)
|
|
11
|
+
}).optional(),
|
|
15
12
|
drivers: z.object({
|
|
16
13
|
slack: z.boolean(),
|
|
17
14
|
rollbar: z.boolean(),
|
|
18
|
-
console: z.boolean()
|
|
15
|
+
console: z.boolean()
|
|
19
16
|
}),
|
|
20
|
-
rollbar: z
|
|
21
|
-
.object({
|
|
17
|
+
rollbar: z.object({
|
|
22
18
|
accessToken: z.string(),
|
|
23
19
|
enabled: z.boolean(),
|
|
24
20
|
captureUncaught: z.boolean(),
|
|
25
21
|
captureUnhandledRejections: z.boolean(),
|
|
26
|
-
environment: z.string().optional()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
})
|
|
30
|
-
.superRefine((data, ctx) => {
|
|
22
|
+
environment: z.string().optional()
|
|
23
|
+
}).optional()
|
|
24
|
+
}).superRefine(function(data, ctx) {
|
|
31
25
|
if (data.drivers.rollbar && !data.rollbar) {
|
|
32
26
|
ctx.addIssue({
|
|
33
27
|
code: z.ZodIssueCode.custom,
|
|
34
|
-
message: 'Rollbar is required when using the Rollbar driver'
|
|
28
|
+
message: 'Rollbar is required when using the Rollbar driver'
|
|
35
29
|
});
|
|
36
30
|
}
|
|
37
31
|
if (data.drivers.rollbar && !data.rollbar) {
|
|
38
32
|
ctx.addIssue({
|
|
39
33
|
code: z.ZodIssueCode.custom,
|
|
40
|
-
message: 'Rollbar is required when using the Rollbar driver'
|
|
34
|
+
message: 'Rollbar is required when using the Rollbar driver'
|
|
41
35
|
});
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
process.env.REPORTER_DEFER !== ''
|
|
48
|
-
|
|
49
|
-
: true,
|
|
50
|
-
slack: process.env.REPORTER_USE_SLACK === 'true'
|
|
51
|
-
? {
|
|
38
|
+
var getConfig = function() {
|
|
39
|
+
return ConfigValidation.parse({
|
|
40
|
+
isProd: process.env.APP_ENV === 'production',
|
|
41
|
+
deferReporting: typeof process.env.REPORTER_DEFER === 'string' && process.env.REPORTER_DEFER !== '' ? process.env.REPORTER_DEFER === 'true' : true,
|
|
42
|
+
slack: process.env.REPORTER_USE_SLACK === 'true' ? {
|
|
52
43
|
errorChannelId: process.env.SLACK_ERROR_CHANNEL_ID,
|
|
53
44
|
token: process.env.SLACK_TOKEN,
|
|
54
|
-
minimumSeverity: ProblemSeverity.HIGH
|
|
55
|
-
}
|
|
56
|
-
:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
rollbar: process.env.REPORTER_USE_ROLLBAR === 'true'
|
|
63
|
-
? {
|
|
45
|
+
minimumSeverity: ProblemSeverity.HIGH
|
|
46
|
+
} : undefined,
|
|
47
|
+
drivers: {
|
|
48
|
+
slack: process.env.REPORTER_USE_SLACK === 'true',
|
|
49
|
+
rollbar: process.env.REPORTER_USE_ROLLBAR === 'true',
|
|
50
|
+
console: process.env.REPORTER_USE_CONSOLE !== 'false'
|
|
51
|
+
},
|
|
52
|
+
rollbar: process.env.REPORTER_USE_ROLLBAR === 'true' ? {
|
|
64
53
|
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
|
|
65
54
|
enabled: true,
|
|
66
55
|
captureUncaught: true,
|
|
67
56
|
captureUnhandledRejections: true,
|
|
68
|
-
environment: process.env.APP_ENV || process.env.NODE_ENV
|
|
69
|
-
}
|
|
70
|
-
|
|
57
|
+
environment: process.env.APP_ENV || process.env.NODE_ENV
|
|
58
|
+
} : undefined
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export var config = initSingleton('reporterConfig', function() {
|
|
62
|
+
return getConfig();
|
|
71
63
|
});
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
export var resetConfig = function() {
|
|
65
|
+
config = initSingleton('reporterConfig', function() {
|
|
66
|
+
return getConfig();
|
|
67
|
+
}, true);
|
|
75
68
|
return config;
|
|
76
69
|
};
|
|
77
|
-
export
|
|
70
|
+
export var setConfig = function(key, value) {
|
|
78
71
|
config[key] = value;
|
|
79
72
|
};
|
|
80
|
-
//# sourceMappingURL=config.js.map
|
package/dist/drivers/console.js
CHANGED
|
@@ -1,17 +1,198 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
|
+
if (!(instance instanceof Constructor)) {
|
|
32
|
+
throw new TypeError("Cannot call a class as a function");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
15
42
|
}
|
|
16
43
|
}
|
|
17
|
-
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
|
+
var f, y, t, _ = {
|
|
64
|
+
label: 0,
|
|
65
|
+
sent: function() {
|
|
66
|
+
if (t[0] & 1) throw t[1];
|
|
67
|
+
return t[1];
|
|
68
|
+
},
|
|
69
|
+
trys: [],
|
|
70
|
+
ops: []
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
|
+
return this;
|
|
74
|
+
}), g;
|
|
75
|
+
function verb(n) {
|
|
76
|
+
return function(v) {
|
|
77
|
+
return step([
|
|
78
|
+
n,
|
|
79
|
+
v
|
|
80
|
+
]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function step(op) {
|
|
84
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
86
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
87
|
+
if (y = 0, t) op = [
|
|
88
|
+
op[0] & 2,
|
|
89
|
+
t.value
|
|
90
|
+
];
|
|
91
|
+
switch(op[0]){
|
|
92
|
+
case 0:
|
|
93
|
+
case 1:
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
case 4:
|
|
97
|
+
_.label++;
|
|
98
|
+
return {
|
|
99
|
+
value: op[1],
|
|
100
|
+
done: false
|
|
101
|
+
};
|
|
102
|
+
case 5:
|
|
103
|
+
_.label++;
|
|
104
|
+
y = op[1];
|
|
105
|
+
op = [
|
|
106
|
+
0
|
|
107
|
+
];
|
|
108
|
+
continue;
|
|
109
|
+
case 7:
|
|
110
|
+
op = _.ops.pop();
|
|
111
|
+
_.trys.pop();
|
|
112
|
+
continue;
|
|
113
|
+
default:
|
|
114
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
115
|
+
_ = 0;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
119
|
+
_.label = op[1];
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
123
|
+
_.label = t[1];
|
|
124
|
+
t = op;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (t && _.label < t[2]) {
|
|
128
|
+
_.label = t[2];
|
|
129
|
+
_.ops.push(op);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (t[2]) _.ops.pop();
|
|
133
|
+
_.trys.pop();
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
op = body.call(thisArg, _);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
op = [
|
|
139
|
+
6,
|
|
140
|
+
e
|
|
141
|
+
];
|
|
142
|
+
y = 0;
|
|
143
|
+
} finally{
|
|
144
|
+
f = t = 0;
|
|
145
|
+
}
|
|
146
|
+
if (op[0] & 5) throw op[1];
|
|
147
|
+
return {
|
|
148
|
+
value: op[0] ? op[1] : void 0,
|
|
149
|
+
done: true
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export var ConsoleDriver = /*#__PURE__*/ function() {
|
|
154
|
+
"use strict";
|
|
155
|
+
function ConsoleDriver() {
|
|
156
|
+
_class_call_check(this, ConsoleDriver);
|
|
157
|
+
_define_property(this, "payload", void 0);
|
|
158
|
+
}
|
|
159
|
+
_create_class(ConsoleDriver, [
|
|
160
|
+
{
|
|
161
|
+
key: "reportError",
|
|
162
|
+
value: function reportError(err, _) {
|
|
163
|
+
return _async_to_generator(function() {
|
|
164
|
+
return _ts_generator(this, function(_state) {
|
|
165
|
+
console.error('An error happened');
|
|
166
|
+
console.error('Error', err);
|
|
167
|
+
console.error('Payload', this.payload);
|
|
168
|
+
return [
|
|
169
|
+
2
|
|
170
|
+
];
|
|
171
|
+
});
|
|
172
|
+
}).call(this);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: "reportProblem",
|
|
177
|
+
value: function reportProblem(problem) {
|
|
178
|
+
return _async_to_generator(function() {
|
|
179
|
+
return _ts_generator(this, function(_state) {
|
|
180
|
+
console.error('A problem happened');
|
|
181
|
+
console.error('Problem', problem);
|
|
182
|
+
console.error('Payload', this.payload);
|
|
183
|
+
return [
|
|
184
|
+
2
|
|
185
|
+
];
|
|
186
|
+
});
|
|
187
|
+
}).call(this);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
key: "setReporterPayload",
|
|
192
|
+
value: function setReporterPayload(payload) {
|
|
193
|
+
this.payload = payload;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
]);
|
|
197
|
+
return ConsoleDriver;
|
|
198
|
+
}();
|
package/dist/drivers/rollbar.js
CHANGED
|
@@ -1,22 +1,213 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
9
13
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
16
27
|
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
|
+
if (!(instance instanceof Constructor)) {
|
|
32
|
+
throw new TypeError("Cannot call a class as a function");
|
|
17
33
|
}
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
}
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
20
42
|
}
|
|
21
43
|
}
|
|
22
|
-
|
|
44
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _ts_generator(thisArg, body) {
|
|
63
|
+
var f, y, t, _ = {
|
|
64
|
+
label: 0,
|
|
65
|
+
sent: function() {
|
|
66
|
+
if (t[0] & 1) throw t[1];
|
|
67
|
+
return t[1];
|
|
68
|
+
},
|
|
69
|
+
trys: [],
|
|
70
|
+
ops: []
|
|
71
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
72
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
73
|
+
return this;
|
|
74
|
+
}), g;
|
|
75
|
+
function verb(n) {
|
|
76
|
+
return function(v) {
|
|
77
|
+
return step([
|
|
78
|
+
n,
|
|
79
|
+
v
|
|
80
|
+
]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function step(op) {
|
|
84
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
86
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
87
|
+
if (y = 0, t) op = [
|
|
88
|
+
op[0] & 2,
|
|
89
|
+
t.value
|
|
90
|
+
];
|
|
91
|
+
switch(op[0]){
|
|
92
|
+
case 0:
|
|
93
|
+
case 1:
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
case 4:
|
|
97
|
+
_.label++;
|
|
98
|
+
return {
|
|
99
|
+
value: op[1],
|
|
100
|
+
done: false
|
|
101
|
+
};
|
|
102
|
+
case 5:
|
|
103
|
+
_.label++;
|
|
104
|
+
y = op[1];
|
|
105
|
+
op = [
|
|
106
|
+
0
|
|
107
|
+
];
|
|
108
|
+
continue;
|
|
109
|
+
case 7:
|
|
110
|
+
op = _.ops.pop();
|
|
111
|
+
_.trys.pop();
|
|
112
|
+
continue;
|
|
113
|
+
default:
|
|
114
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
115
|
+
_ = 0;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
119
|
+
_.label = op[1];
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
123
|
+
_.label = t[1];
|
|
124
|
+
t = op;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (t && _.label < t[2]) {
|
|
128
|
+
_.label = t[2];
|
|
129
|
+
_.ops.push(op);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (t[2]) _.ops.pop();
|
|
133
|
+
_.trys.pop();
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
op = body.call(thisArg, _);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
op = [
|
|
139
|
+
6,
|
|
140
|
+
e
|
|
141
|
+
];
|
|
142
|
+
y = 0;
|
|
143
|
+
} finally{
|
|
144
|
+
f = t = 0;
|
|
145
|
+
}
|
|
146
|
+
if (op[0] & 5) throw op[1];
|
|
147
|
+
return {
|
|
148
|
+
value: op[0] ? op[1] : void 0,
|
|
149
|
+
done: true
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
import Rollbar from 'rollbar';
|
|
154
|
+
export var RollbarDriver = /*#__PURE__*/ function() {
|
|
155
|
+
"use strict";
|
|
156
|
+
function RollbarDriver(rollbarConfig) {
|
|
157
|
+
_class_call_check(this, RollbarDriver);
|
|
158
|
+
_define_property(this, "rollbar", void 0);
|
|
159
|
+
this.rollbar = new Rollbar(rollbarConfig);
|
|
160
|
+
}
|
|
161
|
+
_create_class(RollbarDriver, [
|
|
162
|
+
{
|
|
163
|
+
key: "reportError",
|
|
164
|
+
value: function reportError(err, metadata) {
|
|
165
|
+
return _async_to_generator(function() {
|
|
166
|
+
return _ts_generator(this, function(_state) {
|
|
167
|
+
this.rollbar.error(err, metadata.request || {}, metadata.others);
|
|
168
|
+
return [
|
|
169
|
+
2
|
|
170
|
+
];
|
|
171
|
+
});
|
|
172
|
+
}).call(this);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
key: "reportProblem",
|
|
177
|
+
value: function reportProblem(problem) {
|
|
178
|
+
return _async_to_generator(function() {
|
|
179
|
+
var _this;
|
|
180
|
+
return _ts_generator(this, function(_state) {
|
|
181
|
+
switch(_state.label){
|
|
182
|
+
case 0:
|
|
183
|
+
_this = this;
|
|
184
|
+
return [
|
|
185
|
+
4,
|
|
186
|
+
new Promise(function(resolve) {
|
|
187
|
+
var _problem_privateMetadata, _problem_privateMetadata1;
|
|
188
|
+
_this.rollbar.error(((_problem_privateMetadata = problem.privateMetadata) === null || _problem_privateMetadata === void 0 ? void 0 : _problem_privateMetadata.error) || new Error(problem.message || problem.code), (_problem_privateMetadata1 = problem.privateMetadata) === null || _problem_privateMetadata1 === void 0 ? void 0 : _problem_privateMetadata1.request, problem.privateMetadata || {}, function(error) {
|
|
189
|
+
resolve(error);
|
|
190
|
+
});
|
|
191
|
+
})
|
|
192
|
+
];
|
|
193
|
+
case 1:
|
|
194
|
+
_state.sent();
|
|
195
|
+
return [
|
|
196
|
+
2
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}).call(this);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
key: "setReporterPayload",
|
|
205
|
+
value: function setReporterPayload(payload) {
|
|
206
|
+
this.rollbar.configure({
|
|
207
|
+
payload: payload
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]);
|
|
212
|
+
return RollbarDriver;
|
|
213
|
+
}();
|