MCPcopy Create free account
hub / github.com/nodejs/nan / NAN_METHOD

Function NAN_METHOD

test/cpp/trycatch.cpp:13–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11using namespace Nan; // NOLINT(build/namespaces)
12
13NAN_METHOD(TryCatchTest) {
14 TryCatch try_catch;
15 v8::Local<v8::String> s = New("throw 'waaa'").ToLocalChecked();
16 v8::Local<UnboundScript> script = New<UnboundScript>(s).ToLocalChecked();
17 MaybeLocal<v8::Value> result = RunScript(script);
18 if (result.IsEmpty()) {
19 assert(try_catch.HasCaught());
20 try_catch.ReThrow();
21 }
22}
23
24NAN_MODULE_INIT(Init) {
25 Set(target

Callers

nothing calls this directly

Calls 6

RunScriptFunction · 0.85
ToLocalCheckedMethod · 0.80
HasCaughtMethod · 0.80
ReThrowMethod · 0.80
NewFunction · 0.50
IsEmptyMethod · 0.45

Tested by

no test coverage detected