Commit c0ec30bf authored by jan.koester's avatar jan.koester
Browse files

test

parent 6720876a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ public:
        v8::Isolate::Scope isolateScope(isolate);
        v8::HandleScope handleScope(isolate);
        v8::Context::Scope contextScope(context);
        node::async_context asyncContext{0, 0};
        node::CallbackScope callbackScope(setup_->env(), context->Global(), asyncContext);
        v8::TryCatch tryCatch(isolate);

        auto fn = runFunction_.Get(isolate);
        v8::Local<v8::Value> argv[2] = {
@@ -120,7 +123,13 @@ public:
        };

        if (fn->Call(context, context->Global(), 2, argv).IsEmpty()) {
          if (tryCatch.HasCaught()) {
            v8::String::Utf8Value exceptionUtf8(isolate, tryCatch.Exception());
            const char *msg = *exceptionUtf8 ? *exceptionUtf8 : "unknown JS exception";
            std::cerr << "Node embedded runtime error: run function call failed: " << msg << std::endl;
          } else {
            std::cerr << "Node embedded runtime error: run function call failed" << std::endl;
          }
            return 1;
        }