| 1 | #include <napi.h> |
| 2 | |
| 3 | class ConstructorExceptionTest |
| 4 | : public Napi::ObjectWrap<ConstructorExceptionTest> { |
| 5 | public: |
| 6 | ConstructorExceptionTest(const Napi::CallbackInfo& info) |
| 7 | : Napi::ObjectWrap<ConstructorExceptionTest>(info) { |
| 8 | Napi::Error error = Napi::Error::New(info.Env(), "an exception"); |
| 9 | #ifdef NAPI_DISABLE_CPP_EXCEPTIONS |
| 10 | error.ThrowAsJavaScriptException(); |
| 11 | #else |
| 12 | throw error; |
| 13 | #endif // NAPI_DISABLE_CPP_EXCEPTIONS |
| 14 | } |
| 15 | |
| 16 | static void Initialize(Napi::Env env, Napi::Object exports) { |
| 17 | const char* name = "ConstructorExceptionTest"; |
| 18 | exports.Set(name, DefineClass(env, name, {})); |
| 19 | } |
| 20 | }; |
| 21 | |
| 22 | Napi::Object InitObjectWrapConstructorException(Napi::Env env) { |
| 23 | Napi::Object exports = Napi::Object::New(env); |
nothing calls this directly
no outgoing calls
no test coverage detected