Skip to content

n-api: add code parameter to error helpers

In support of the effort to add error codes to all errors generated by Node.js, add an optional code parameter to the helper functions used to throw/create errors in N-API.

Fixes: https://github.com/nodejs/node/issues/13933

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
Affected core subsystem(s)

n-api

This does assume that we are ok changing the existing APIs, that will require that we update the wrapper and our ports. The alternative would be to add new functions (maybe _with_code) instead. I lean towards the replace as it does the most to encourage the use of the code, but do want everybody's feedback on the right way to go at this point.

Merge request reports

Loading