| 1 |
import { config } from '../config'; |
| 2 |
var context = null; |
| 3 |
export function errorContext(cb) { |
| 4 |
if (config.useDeprecatedSynchronousErrorHandling) { |
| 5 |
var isRoot = !context; |
| 6 |
if (isRoot) { |
| 7 |
context = { errorThrown: false, error: null }; |
| 8 |
} |
| 9 |
cb(); |
| 10 |
if (isRoot) { |
| 11 |
var _a = context, errorThrown = _a.errorThrown, error = _a.error; |
| 12 |
context = null; |
| 13 |
if (errorThrown) { |
| 14 |
throw error; |
| 15 |
} |
| 16 |
} |
| 17 |
} |
| 18 |
else { |
| 19 |
cb(); |
| 20 |
} |
| 21 |
} |
| 22 |
export function captureError(err) { |
| 23 |
if (config.useDeprecatedSynchronousErrorHandling && context) { |
| 24 |
context.errorThrown = true; |
| 25 |
context.error = err; |
| 26 |
} |
| 27 |
} |
| 28 |
//# sourceMappingURL=errorContext.js.map |