Debian Codegraph @

node/rxjs/dist/cjs/internal/util/errorContext.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.captureError = exports.errorContext = void 0;
4 var config_1 = require("../config");
5 var context = null;
6 function errorContext(cb) {
7 if (config_1.config.useDeprecatedSynchronousErrorHandling) {
8 var isRoot = !context;
9 if (isRoot) {
10 context = { errorThrown: false, error: null };
11 }
12 cb();
13 if (isRoot) {
14 var _a = context, errorThrown = _a.errorThrown, error = _a.error;
15 context = null;
16 if (errorThrown) {
17 throw error;
18 }
19 }
20 }
21 else {
22 cb();
23 }
24 }
25 exports.errorContext = errorContext;
26 function captureError(err) {
27 if (config_1.config.useDeprecatedSynchronousErrorHandling && context) {
28 context.errorThrown = true;
29 context.error = err;
30 }
31 }
32 exports.captureError = captureError;
33 //# sourceMappingURL=errorContext.js.map