1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +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:
Pavel 2022-10-08 19:38:32 +04:00 committed by Linus Groh
parent 2eb6dbd4f0
commit 40aad77ab1
14 changed files with 86 additions and 58 deletions

View file

@ -82,6 +82,7 @@ public:
ThrowCompletionOr<Value> time_end();
void output_debug_message(LogLevel log_level, String output) const;
void report_exception(JS::Error const&, bool) const;
private:
ThrowCompletionOr<String> value_vector_to_string(MarkedVector<Value> const&);
@ -108,7 +109,8 @@ public:
ThrowCompletionOr<MarkedVector<Value>> formatter(MarkedVector<Value> const& args);
virtual ThrowCompletionOr<Value> printer(Console::LogLevel log_level, PrinterArguments) = 0;
virtual void add_css_style_to_current_message(StringView) {};
virtual void add_css_style_to_current_message(StringView) { }
virtual void report_exception(JS::Error const&, bool) { }
virtual void clear() = 0;
virtual void end_group() = 0;