You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Napi::Error may become invalid if it is thrown out of a handle scope #31
When a Napi::Error is constructed, it acquires a handle to a JS error object via napi_get_and_clear_last_exception(). Then the Napi::Error instance is intended to be thrown and caught as a C++ exception. But if any stack frame between where it is thrown and where it is caught has set up a handle scope, then the error object handle gets released as the exception propagates up the stack.
One way to resolve this is whenever using handle scopes be sure to catch any Napi::Error and escape it from the scope before re-throwing it. But this makes it difficult to use handle scopes correctly and therefore would result in bugs that only occur in exception conditions. So, not a good solution.
Instead, the Error class can be changed to acquire a persistent reference to the error object, instead of just a handle. I'm working on this.
Activity
Make Error a persistent reference
Make Error a persistent reference
Make Error a persistent reference (#32)
Make Error a persistent reference (#32)
Make Error a persistent reference (#32)
Make Error a persistent reference (#32)
Make Error a persistent reference (#32)