Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8bc1651

Browse filesBrowse files
mhdawsonaddaleax
authored andcommitted
doc: add clarification for exception behaviour
Document current behaviour where some methods can be called when an exception is pending, while others cannot and explain the behaviour. PR-URL: #25339 Refs: nodejs/abi-stable-node#356 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent f3d8639 commit 8bc1651
Copy full SHA for 8bc1651

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/n-api.md‎

Copy file name to clipboardExpand all lines: doc/api/n-api.md
+9Lines changed: 9 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,15 @@ exception is pending and no additional action is required. If the
527527
instead of simply returning immediately, [`napi_is_exception_pending`][]
528528
must be called in order to determine if an exception is pending or not.
529529

530+
In many cases when an N-API function is called and an exception is
531+
already pending, the function will return immediately with a
532+
`napi_status` of `napi_pending_exception`. However, this is not the case
533+
for all functions. N-API allows a subset of the functions to be
534+
called to allow for some minimal cleanup before returning to JavaScript.
535+
In that case, `napi_status` will reflect the status for the function. It
536+
will not reflect previous pending exceptions. To avoid confusion, check
537+
the error status after every function call.
538+
530539
When an exception is pending one of two approaches can be employed.
531540

532541
The first approach is to do any appropriate cleanup and then return so that

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.