diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-01 17:03:17 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-02 04:53:01 +0430 |
commit | b538e15548cf3760c71e4b60cf3820c902748c8f (patch) | |
tree | 5daed8e96d8ed5043c3528baef31559c7d07f9a6 /Userland/Libraries/LibWeb/WebAssembly | |
parent | 62ca81fdcc7ab999739e3ddb6c26e196e9357962 (diff) | |
download | serenity-b538e15548cf3760c71e4b60cf3820c902748c8f.zip |
LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly')
-rw-r--r-- | Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index c21dd3daf6..1c298bdbad 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -432,7 +432,7 @@ JS::NativeFunction* create_native_function(Wasm::FunctionAddress address, String auto result = WebAssemblyObject::s_abstract_machine.invoke(address, move(values)); // FIXME: Use the convoluted mapping of errors defined in the spec. if (result.is_trap()) { - vm.throw_exception<JS::TypeError>(global_object, "Wasm execution trapped (WIP)"); + vm.throw_exception<JS::TypeError>(global_object, String::formatted("Wasm execution trapped (WIP): {}", result.trap().reason)); return {}; } |