I was writing a small Cpp addon trying to see if there exists a scenario where the _ref class variable of Error class might be a nullptr.

Since it looks like the error_code napi_boolean_expected isn't handled by the switch statement inside Error::New().
Though it looks like even though we are able to retrieve the error info using napi_get_last_error_info , once we call napi_is_exception_pending we will clear the last error and thus lose the error info from the previous invocation.

I am just wondering if this is the expected behaviour? Since it looks like the original error info( a const) is intended to be used elsewhere in the function body. Thanks!