@driveflux/reporter 6.0.4-next.1 → 6.0.4-next.2
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.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/drivers/console.js +13 -194
- package/dist/drivers/rollbar.js +16 -207
- package/dist/drivers/slack.js +117 -340
- package/dist/index.js +67 -372
- package/dist/types.js +2 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -16,6 +16,9 @@ export declare const ConfigValidation: z.ZodObject<{
|
|
|
16
16
|
rollbar: z.ZodOptional<z.ZodObject<{
|
|
17
17
|
accessToken: z.ZodString;
|
|
18
18
|
enabled: z.ZodBoolean;
|
|
19
|
+
captureUncaught: z.ZodBoolean;
|
|
20
|
+
captureUnhandledRejections: z.ZodBoolean;
|
|
21
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
19
22
|
}, z.core.$strip>>;
|
|
20
23
|
}, z.core.$strip>;
|
|
21
24
|
export type Config = z.infer<typeof ConfigValidation>;
|
|
@@ -36,6 +39,9 @@ export declare const resetConfig: () => {
|
|
|
36
39
|
rollbar?: {
|
|
37
40
|
accessToken: string;
|
|
38
41
|
enabled: boolean;
|
|
42
|
+
captureUncaught: boolean;
|
|
43
|
+
captureUnhandledRejections: boolean;
|
|
44
|
+
environment?: string | undefined;
|
|
39
45
|
} | undefined;
|
|
40
46
|
};
|
|
41
47
|
export declare const setConfig: <Key extends keyof Config>(key: Key, value: Config[Key]) => void;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;iBAuC1B,CAAA;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAoCrD,eAAO,IAAI,MAAM,EAAE,MAA2D,CAAA;AAE9E,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;CAIvB,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,GAAG,SAAS,MAAM,MAAM,EACjD,KAAK,GAAG,EACR,OAAO,MAAM,CAAC,GAAG,CAAC,SAGlB,CAAA"}
|
package/dist/config.js
CHANGED
|
@@ -9,7 +9,7 @@ export const ConfigValidation = z
|
|
|
9
9
|
.object({
|
|
10
10
|
errorChannelId: z.string(),
|
|
11
11
|
token: z.string(),
|
|
12
|
-
minimumSeverity: z.
|
|
12
|
+
minimumSeverity: z.enum(ProblemSeverity),
|
|
13
13
|
})
|
|
14
14
|
.optional(),
|
|
15
15
|
drivers: z.object({
|
|
@@ -21,6 +21,9 @@ export const ConfigValidation = z
|
|
|
21
21
|
.object({
|
|
22
22
|
accessToken: z.string(),
|
|
23
23
|
enabled: z.boolean(),
|
|
24
|
+
captureUncaught: z.boolean(),
|
|
25
|
+
captureUnhandledRejections: z.boolean(),
|
|
26
|
+
environment: z.string().optional(),
|
|
24
27
|
})
|
|
25
28
|
.optional(),
|
|
26
29
|
})
|
|
@@ -68,7 +71,6 @@ const getConfig = () => ConfigValidation.parse({
|
|
|
68
71
|
});
|
|
69
72
|
export let config = initSingleton('reporterConfig', () => getConfig());
|
|
70
73
|
export const resetConfig = () => {
|
|
71
|
-
console.log('SLACK_ERROR_CHANNEL_ID?', process.env.SLACK_ERROR_CHANNEL_ID);
|
|
72
74
|
config = initSingleton('reporterConfig', () => getConfig(), true);
|
|
73
75
|
return config;
|
|
74
76
|
};
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,KAAK,EAAE,CAAC;SACN,MAAM,CAAC;QACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,eAAe,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,KAAK,EAAE,CAAC;SACN,MAAM,CAAC;QACP,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC;KACxC,CAAC;SACD,QAAQ,EAAE;IACZ,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;Q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AAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AACpB,CAAC,CAAA"}
|
package/dist/drivers/console.js
CHANGED
|
@@ -1,198 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return;
|
|
1
|
+
export class ConsoleDriver {
|
|
2
|
+
payload;
|
|
3
|
+
async reportError(err, _) {
|
|
4
|
+
console.error('An error happened');
|
|
5
|
+
console.error('Error', err);
|
|
6
|
+
console.error('Payload', this.payload);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
async reportProblem(problem) {
|
|
9
|
+
console.error('A problem happened');
|
|
10
|
+
console.error('Problem', problem);
|
|
11
|
+
console.error('Payload', this.payload);
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
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);
|
|
13
|
+
setReporterPayload(payload) {
|
|
14
|
+
this.payload = payload;
|
|
42
15
|
}
|
|
43
16
|
}
|
|
44
|
-
|
|
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
|
-
}();
|
|
17
|
+
//# sourceMappingURL=console.js.map
|
package/dist/drivers/rollbar.js
CHANGED
|
@@ -1,213 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
1
|
+
import Rollbar from 'rollbar';
|
|
2
|
+
export class RollbarDriver {
|
|
3
|
+
rollbar;
|
|
4
|
+
constructor(rollbarConfig) {
|
|
5
|
+
this.rollbar = new Rollbar(rollbarConfig);
|
|
8
6
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
7
|
+
async reportError(err, metadata) {
|
|
8
|
+
this.rollbar.error(err, metadata.request || {}, metadata.others);
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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);
|
|
10
|
+
async reportProblem(problem) {
|
|
11
|
+
await new Promise((resolve) => {
|
|
12
|
+
this.rollbar.error(problem.privateMetadata?.error ||
|
|
13
|
+
new Error(problem.message || problem.code), problem.privateMetadata?.request, problem.privateMetadata || {}, (error) => {
|
|
14
|
+
resolve(error);
|
|
15
|
+
});
|
|
27
16
|
});
|
|
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
17
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
18
|
+
setReporterPayload(payload) {
|
|
19
|
+
this.rollbar.configure({ payload });
|
|
42
20
|
}
|
|
43
21
|
}
|
|
44
|
-
|
|
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
|
-
}();
|
|
22
|
+
//# sourceMappingURL=rollbar.js.map
|