1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

LibWeb/WebIDL: Store SimpleException message as a String{,View} variant

This commit is contained in:
Linus Groh 2023-03-03 18:04:58 +00:00
parent 1032ac2453
commit 11b40dbcf5
8 changed files with 28 additions and 24 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, the SerenityOS developers.
* Copyright (c) 2021-2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -60,10 +60,11 @@ ALWAYS_INLINE JS::Completion dom_exception_to_throw_completion(JS::VM& vm, auto&
{
return exception.visit(
[&](WebIDL::SimpleException const& exception) {
auto message = exception.message.visit([](auto const& s) -> StringView { return s; });
switch (exception.type) {
#define E(x) \
case WebIDL::SimpleExceptionType::x: \
return vm.template throw_completion<JS::x>(exception.message);
return vm.template throw_completion<JS::x>(message);
ENUMERATE_SIMPLE_WEBIDL_EXCEPTION_TYPES(E)