summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-11-23 22:56:21 +0200
committerLinus Groh <mail@linusgroh.de>2021-11-24 18:05:24 +0000
commit15fafdc645ef6a477dd3d2ccdd36c07ff8f74188 (patch)
tree3990e86ee34550404cf7920d28b53095aeb1244f /Userland/Utilities
parent11d1950e742a6a2ec11e852e644e24682cd5072e (diff)
downloadserenity-15fafdc645ef6a477dd3d2ccdd36c07ff8f74188.zip
js: Pretty-print custom error types
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/js.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp
index d5a10ee759..fc6b275910 100644
--- a/Userland/Utilities/js.cpp
+++ b/Userland/Utilities/js.cpp
@@ -742,6 +742,13 @@ static void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects)
return print_date(object, seen_objects);
if (is<JS::Error>(object))
return print_error(object, seen_objects);
+
+ auto prototype_or_error = object.internal_get_prototype_of();
+ if (prototype_or_error.has_value() && prototype_or_error.value() == object.global_object().error_prototype())
+ return print_error(object, seen_objects);
+ vm->clear_exception();
+ vm->stop_unwind();
+
if (is<JS::RegExpObject>(object))
return print_regexp_object(object, seen_objects);
if (is<JS::Map>(object))