Serenity Operating System
at master 28 lines 570 B view raw
1/* 2 * Copyright (c) 2022, David Tuin <davidot@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <LibJS/Forward.h> 10 11namespace Web::HTML { 12 13enum class ErrorInPromise { 14 No, 15 Yes, 16}; 17 18void report_exception_to_console(JS::Value, JS::Realm&, ErrorInPromise); 19void report_exception(JS::Completion const&, JS::Realm&); 20 21template<typename T> 22inline void report_exception(JS::ThrowCompletionOr<T> const& result, JS::Realm& realm) 23{ 24 VERIFY(result.is_throw_completion()); 25 report_exception(result.throw_completion(), realm); 26} 27 28}