wishthis/node_modules/rxjs/dist/esm/internal/util/errorContext.js
2022-06-08 12:36:39 +02:00

28 lines
No EOL
726 B
JavaScript

import { config } from '../config';
let context = null;
export function errorContext(cb) {
if (config.useDeprecatedSynchronousErrorHandling) {
const isRoot = !context;
if (isRoot) {
context = { errorThrown: false, error: null };
}
cb();
if (isRoot) {
const { errorThrown, error } = context;
context = null;
if (errorThrown) {
throw error;
}
}
}
else {
cb();
}
}
export function captureError(err) {
if (config.useDeprecatedSynchronousErrorHandling && context) {
context.errorThrown = true;
context.error = err;
}
}
//# sourceMappingURL=errorContext.js.map