mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:27:35 +00:00
Tests/LibWasm: Handle all stream errors in parse_webassembly_module
This commit is contained in:
parent
2c7e2e351a
commit
30a1a25daa
1 changed files with 5 additions and 0 deletions
|
@ -104,6 +104,11 @@ TESTJS_GLOBAL_FUNCTION(parse_webassembly_module, parseWebAssemblyModule)
|
|||
}
|
||||
auto& array = static_cast<JS::Uint8Array&>(*object);
|
||||
InputMemoryStream stream { array.data() };
|
||||
ScopeGuard handle_stream_error {
|
||||
[&] {
|
||||
stream.handle_any_error();
|
||||
}
|
||||
};
|
||||
auto result = Wasm::Module::parse(stream);
|
||||
if (result.is_error()) {
|
||||
vm.throw_exception<JS::SyntaxError>(global_object, Wasm::parse_error_to_string(result.error()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue