From dd9c594cbc2a9d2e243f8d01ff537c6c0dd02f36 Mon Sep 17 00:00:00 2001 From: Nicola Del Gobbo Date: Fri, 25 Nov 2022 13:19:31 +0100 Subject: [PATCH 1/2] doc: Napi::Error is caught. --- doc/error_handling.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/error_handling.md b/doc/error_handling.md index 6882d599f..81e46d12c 100644 --- a/doc/error_handling.md +++ b/doc/error_handling.md @@ -26,7 +26,7 @@ The following sections explain the approach for each case: In most cases when an error occurs, the addon should do whatever cleanup is possible -and then return to JavaScript so that the error can be propagated. In less frequent +and then return to JavaScript so that the error can be propagated. In less frequent cases the addon may be able to recover from the error, clear the error and then continue. @@ -48,8 +48,8 @@ method. If a C++ exception of type `Napi::Error` escapes from a Node-API C++ callback, then the Node-API wrapper automatically converts and throws it as a JavaScript exception. -On return from a native method, node-addon-api will automatically convert a pending C++ -exception to a JavaScript exception. +On return from a native method, node-addon-api will automatically convert a pending +`Napi:Error` C++ exception to a JavaScript exception. When C++ exceptions are enabled try/catch can be used to catch exceptions thrown from calls to JavaScript and then they can either be handled or rethrown before From 14bc5d3e13c81e76de1b9b637fdcd3ba11a241ca Mon Sep 17 00:00:00 2001 From: Nicola Del Gobbo Date: Fri, 25 Nov 2022 13:22:43 +0100 Subject: [PATCH 2/2] fixed typo --- doc/error_handling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/error_handling.md b/doc/error_handling.md index 81e46d12c..5bb7481aa 100644 --- a/doc/error_handling.md +++ b/doc/error_handling.md @@ -49,7 +49,7 @@ If a C++ exception of type `Napi::Error` escapes from a Node-API C++ callback, t the Node-API wrapper automatically converts and throws it as a JavaScript exception. On return from a native method, node-addon-api will automatically convert a pending -`Napi:Error` C++ exception to a JavaScript exception. +`Napi::Error` C++ exception to a JavaScript exception. When C++ exceptions are enabled try/catch can be used to catch exceptions thrown from calls to JavaScript and then they can either be handled or rethrown before