From 4279f8c49081bb971d1cf28e5ce3872a15c5ab9e Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Wed, 2 Oct 2024 11:03:37 +0200 Subject: [PATCH] cache crash handler --- src/globals.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/globals.js b/src/globals.js index 8b223bb..9abea2b 100644 --- a/src/globals.js +++ b/src/globals.js @@ -12,13 +12,14 @@ */ const resolved = Promise.resolve() +const crashError = err => setImmediate(() => { throw err }) global.queueMicrotask = function queueMicrotask (fn) { resolved .then(fn) // Make sure that exceptions are reported as normal uncaughts, not promise // rejections. - .catch(err => setImmediate(() => { throw err })) + .catch(crashError) } /**