UNPKG

757 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const notifier_1 = require("./notifier");
4class ErrorReporter {
5 constructor(notifier) {
6 this.notifier = notifier;
7 }
8 reportError(error) {
9 this.notifier.emit(notifier_1.GraphiteEvent.DidError, { error });
10 }
11 onError(handler) {
12 return this.notifier.on(notifier_1.GraphiteEvent.DidError, async (...args) => {
13 try {
14 await handler(...args);
15 }
16 catch (ex) {
17 console.error('Exception thrown in ErrorReporter#onError handler', ex);
18 }
19 });
20 }
21}
22exports.errorReporter = new ErrorReporter(notifier_1.createNotifier());
23//# sourceMappingURL=errorReporter.js.map
\No newline at end of file