Skip to content

Commit

Permalink
cache crash handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh authored Oct 2, 2024
1 parent d0bc9ed commit 4279f8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down

0 comments on commit 4279f8c

Please sign in to comment.