Skip to content

node_api: fix uncaught exceptions in async worker

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This fixes an issue with n-api where an uncaught exception triggered in the async worker callback would lead to js weirdness or node panics.

The main issue was we were calling js functions after doing isolate->ThrowException which the v8 documentation states is illegal

Fix is to simply use the other FatalException interface which allows passing in the local value and message directly.

I've added a test that showcases the problem as well (panics on my machine)

Merge request reports

Loading