Skip to content
12 changes: 7 additions & 5 deletions src/v8/v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class V8 : public WasmVm {
private:
wasm::own<wasm::Trap> trap(std::string message);

std::string getFailMessage(std::string_view function_name, wasm::own<wasm::Trap> trap);
std::string getPluginFailMessage(std::string_view function_name, wasm::own<wasm::Trap> trap);

template <typename... Args>
void registerHostFunctionImpl(std::string_view module_name, std::string_view function_name,
Expand Down Expand Up @@ -638,7 +638,8 @@ void V8::getModuleFunctionImpl(std::string_view function_name,
}

if (trap) {
fail(FailState::RuntimeError, getFailMessage(std::string(function_name), std::move(trap)));
fail(FailState::RuntimeError,
getPluginFailMessage(std::string(function_name), std::move(trap)));
return;
}
if (log) {
Expand Down Expand Up @@ -690,7 +691,8 @@ void V8::getModuleFunctionImpl(std::string_view function_name,
}

if (trap) {
fail(FailState::RuntimeError, getFailMessage(std::string(function_name), std::move(trap)));
fail(FailState::RuntimeError,
getPluginFailMessage(std::string(function_name), std::move(trap)));
return R{};
}
R rvalue = results[0].get<typename ConvertWordTypeToUint32<R>::type>();
Expand All @@ -708,8 +710,8 @@ void V8::terminate() {
isolate->TerminateExecution();
}

std::string V8::getFailMessage(std::string_view function_name, wasm::own<wasm::Trap> trap) {
auto message = "Function: " + std::string(function_name) + " failed: ";
std::string V8::getPluginFailMessage(std::string_view function_name, wasm::own<wasm::Trap> trap) {
auto message = "Plugin Crash: Function: " + std::string(function_name) + " failed: ";
message += std::string(trap->message().get(), trap->message().size());

if (function_names_index_.empty()) {
Expand Down
Loading