mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 08:57:35 +00:00
LibWeb/Fetch: Store Response error message as a String{,View} variant
The majority of error strings are StringView literals, and it seems
silly to require heap-allocating strings for these.
This idea is stolen from a recent change in fd1fbad
:^)
This commit is contained in:
parent
03f32bdf86
commit
1032ac2453
5 changed files with 45 additions and 37 deletions
|
@ -99,8 +99,8 @@ JS::NonnullGCPtr<JS::Promise> fetch_impl(JS::VM& vm, RequestInfo const& input, R
|
|||
|
||||
// 3. If response is a network error, then reject p with a TypeError and abort these steps.
|
||||
if (response->is_network_error()) {
|
||||
auto message = response->network_error_message().value_or("Response is a network error"_string.release_value_but_fixme_should_propagate_errors());
|
||||
WebIDL::reject_promise(vm, promise_capability, JS::TypeError::create(relevant_realm, move(message)));
|
||||
auto message = response->network_error_message().value_or("Response is a network error"sv);
|
||||
WebIDL::reject_promise(vm, promise_capability, JS::TypeError::create(relevant_realm, message).release_allocated_value_but_fixme_should_propagate_errors());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue