mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibJS+Everywhere: Convert JS::Error to String
This includes an Error::create overload to create an Error from a UTF-8 StringView. If creating a String from that view fails, the factory will return an OOM InternalError instead. VM::throw_completion can also make use of this overload via its perfect forwarding.
This commit is contained in:
parent
153b793638
commit
88814acbd3
36 changed files with 198 additions and 151 deletions
|
@ -57,7 +57,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> WebAssemblyTableConstructor:
|
|||
maximum = TRY(maximum_value.to_u32(vm));
|
||||
|
||||
if (maximum.has_value() && maximum.value() < initial)
|
||||
return vm.throw_completion<JS::RangeError>("maximum should be larger than or equal to initial");
|
||||
return vm.throw_completion<JS::RangeError>("maximum should be larger than or equal to initial"sv);
|
||||
|
||||
auto value_value = TRY(descriptor->get("value"));
|
||||
auto reference_value = TRY([&]() -> JS::ThrowCompletionOr<Wasm::Value> {
|
||||
|
@ -71,7 +71,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> WebAssemblyTableConstructor:
|
|||
|
||||
auto address = WebAssemblyObject::s_abstract_machine.store().allocate(Wasm::TableType { *reference_type, Wasm::Limits { initial, maximum } });
|
||||
if (!address.has_value())
|
||||
return vm.throw_completion<JS::TypeError>("Wasm Table allocation failed");
|
||||
return vm.throw_completion<JS::TypeError>("Wasm Table allocation failed"sv);
|
||||
|
||||
auto& table = *WebAssemblyObject::s_abstract_machine.store().get(*address);
|
||||
for (auto& element : table.elements())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue