Throw the right exception class, and add the thrown value to it

This commit is contained in:
Dale Glass 2023-03-05 14:22:06 +01:00 committed by ksuprynowicz
parent 2a5ec7db3d
commit cb0c62024d

View file

@ -1020,7 +1020,7 @@ void ScriptEngineV8::setUncaughtException(const v8::TryCatch &tryCatch, const QS
return;
}
auto ex = std::make_shared<ScriptException>();
auto ex = std::make_shared<ScriptRuntimeException>();
ex->additionalInfo = info;
v8::Locker locker(_v8Isolate);
@ -1036,6 +1036,10 @@ void ScriptEngineV8::setUncaughtException(const v8::TryCatch &tryCatch, const QS
ex->errorMessage = QString(*utf8Value);
auto exceptionValue = tryCatch.Exception();
ex->thrownValue = ScriptValue(new ScriptValueV8Wrapper(this, V8ScriptValue(this, exceptionValue)));
v8::Local<v8::Message> exceptionMessage = tryCatch.Message();
if (!exceptionMessage.IsEmpty()) {
ex->errorLine = exceptionMessage->GetLineNumber(getContext()).FromJust();