mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:25:06 +00:00
WebContent+LibWeb+LibJS: Report exceptions to the JS console
Print exceptions passed to `HTML::report_exception` in the JS console Refactored `ExceptionReporter`: in order to report exception now you need to pass the relevant realm in it. For passed `JS::Value` we now create `JS::Error` object to print value as the error message.
This commit is contained in:
parent
2eb6dbd4f0
commit
40aad77ab1
14 changed files with 86 additions and 58 deletions
|
@ -15,14 +15,14 @@ enum class ErrorInPromise {
|
|||
Yes,
|
||||
};
|
||||
|
||||
void print_error_from_value(JS::Value, ErrorInPromise);
|
||||
void report_exception(JS::Completion const&);
|
||||
void report_exception_to_console(JS::Value, JS::Realm&, ErrorInPromise);
|
||||
void report_exception(JS::Completion const&, JS::Realm&);
|
||||
|
||||
template<typename T>
|
||||
inline void report_exception(JS::ThrowCompletionOr<T> const& result)
|
||||
inline void report_exception(JS::ThrowCompletionOr<T> const& result, JS::Realm& realm)
|
||||
{
|
||||
VERIFY(result.is_throw_completion());
|
||||
report_exception(result.throw_completion());
|
||||
report_exception(result.throw_completion(), realm);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue