-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding napi_create_syntax_error #1099
Comments
Hi @idan-at, napi_status napi_throw_syntax_error(napi_env env, const char* code, const char* msg);
napi_status napi_create_syntax_error(napi_env env, napi_value code, napi_value msg, napi_value* result); We can disccus this proposal in Node-API Team tomorrow. If you want to partecipate you can find all the info here: https://github.com/nodejs/abi-stable-node#meeting |
@NickNaso thank you for the quick reply. If you find the API useful I will be happy to contribute. Thanks |
We discussed in the Node-API team meeting today, and agreed it would make sense to add methods to throw/create the errors listed in the spec including syntax_error. If you'd like to submit a PR to core to add these and add equivalents to node-addon-api once the core PR lands that would be great. |
Add `napi_create_syntax_error` and `napi_throw_syntax_error`. Fixes: nodejs/node-addon-api#1099
Add `napi_create_syntax_error` and `napi_throw_syntax_error`. Fixes: nodejs/node-addon-api#1099 PR-URL: #40736 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Add `napi_create_syntax_error` and `napi_throw_syntax_error`. Fixes: nodejs/node-addon-api#1099 PR-URL: #40736 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Add `napi_create_syntax_error` and `napi_throw_syntax_error`. Fixes: nodejs/node-addon-api#1099 PR-URL: #40736 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Hi,
Some of the known js tooling (webpack and babel for example) are re-written in other languages (esbuild in go, swc and parcel in rust)
Because of that, throwing a syntax error from napi makes sense.
unfortunately, the API does not exist at this moment (although other native errors can be thrown, like type error and range error)
what do you think about adding it?
If it’s accepted, I’d be happy to contribute (if you can point me)
Thanks!
The text was updated successfully, but these errors were encountered: