What do you do with unhandled promise rejections?
I forward them to window.onerror for possible source map modification of the stack trace, and then exit the process.
https://github.com/ry/v8worker2/blob/d2017b36edb8429471b08b27123981f1abd5fcb0/binding.cc#L61-L91
@ry I think that literally exits when a promise is rejected though:
Namely:
const p = makePromise(); // if `p` is rejected synchronously then the process will exit
await 3; // or something else that just waits but not for I/O
p.catch(() => {}); // or await
It is also fine to ask users to handle all promise rejections "synchronously" - it deviates from web behaviour and I think that if this is intentional then it should be documented.
Following our discussion - we should document the expectation of handling rejections synchronously and keep the current V8 semantic.
I'm going to close this - and follow up with either a docs or code PR (depending on the project state) in 2-3 weeks :)
Most helpful comment
I forward them to window.onerror for possible source map modification of the stack trace, and then exit the process.
https://github.com/ry/v8worker2/blob/d2017b36edb8429471b08b27123981f1abd5fcb0/binding.cc#L61-L91