From eb1fef2be6dab5de75b4351a9c1085b58a8c7e84 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 2 Apr 2020 14:18:19 +0100 Subject: [PATCH] js: Improve exception output for errors with empty message --- Userland/js.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/js.cpp b/Userland/js.cpp index 86467cd9d8b..44b3e3a0342 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -136,7 +136,9 @@ static void print_date(const JS::Object& date, HashTable&) static void print_error(const JS::Object& object, HashTable&) { auto& error = static_cast(object); - printf("\033[34;1m[%s]\033[0m: %s", error.name().characters(), error.message().characters()); + printf("\033[34;1m[%s]\033[0m", error.name().characters()); + if (!error.message().is_empty()) + printf(": %s", error.message().characters()); } void print_value(JS::Value value, HashTable& seen_objects)