Browse Source

LibWeb: Make unhandled JS exception stand out more in debug log

Let's log "unhandled exception" messages in red text so that they stand
out better among lots of other debug logging.
Andreas Kling 3 năm trước cách đây
mục cha
commit
c4ccbc5b83
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      Userland/Libraries/LibWeb/DOM/Document.cpp

+ 3 - 3
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -654,12 +654,12 @@ JS::Interpreter& Document::interpreter()
                     auto message = object.get_without_side_effects(vm.names.message).value_or(JS::js_undefined());
                     if (name.is_accessor() || message.is_accessor()) {
                         // The result is not going to be useful, let's just print the value. This affects DOMExceptions, for example.
-                        dbgln("Unhandled JavaScript exception: {}", value);
+                        dbgln("\033[31;1mUnhandled JavaScript exception:\033[0m {}", value);
                     } else {
-                        dbgln("Unhandled JavaScript exception: [{}] {}", name, message);
+                        dbgln("\033[31;1mUnhandled JavaScript exception:\033[0m [{}] {}", name, message);
                     }
                 } else {
-                    dbgln("Unhandled JavaScript exception: {}", value);
+                    dbgln("\033[31;1mUnhandled JavaScript exception:\033[0m {}", value);
                 }
                 for (auto& traceback_frame : exception->traceback()) {
                     auto& function_name = traceback_frame.function_name;