Skip to content

Commit 0902380

Browse files
author
Mihail Slavchev
committed
check for error
1 parent ae24ee2 commit 0902380

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/jni/Module.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ void Module::Load(const string& path)
192192
auto globalObject = context->Global();
193193
auto require = globalObject->Get(context, ConvertToV8String("require")).ToLocalChecked().As<Function>();
194194
Local<Value> args[] = { ConvertToV8String(path) };
195+
TryCatch tc;
195196
require->Call(context, globalObject, 1, args);
197+
if (tc.HasCaught())
198+
{
199+
throw NativeScriptException(tc, "Fail to load module: " + path);
200+
}
196201
}
197202

198203
Local<Object> Module::LoadImpl(const string& path, bool& isData)

0 commit comments

Comments
 (0)