BindingsGenerator: Allow stringifier to return DOMException if needed

This commit is contained in:
Kenneth Myhra 2023-02-23 09:42:09 +01:00 committed by Sam Atkins
parent e8bd067ce5
commit 511ce240f2
Notes: sideshowbarker 2024-07-16 23:59:28 +09:00

View file

@ -3,6 +3,7 @@
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
* Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -2794,7 +2795,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::to_string)
)~~~");
if (interface.stringifier_attribute.has_value()) {
stringifier_generator.append(R"~~~(
auto retval = impl->@attribute.cpp_getter_name@();
auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return impl->@attribute.cpp_getter_name@(); }));
)~~~");
} else {
stringifier_generator.append(R"~~~(