From 6c89303e7e1096b1bedddb0cc1f67568bbfe9128 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 2 Jun 2020 14:12:04 +0100 Subject: [PATCH] js: Print call stack on exception thrown outside the global context --- Userland/js.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/js.cpp b/Userland/js.cpp index cfc30d217f5..70caa45adba 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -344,6 +344,11 @@ bool parse_and_run(JS::Interpreter& interpreter, const StringView& source) if (interpreter.exception()) { printf("Uncaught exception: "); print(interpreter.exception()->value()); + auto trace = interpreter.exception()->trace(); + if (trace.size() > 1) { + for (auto& function_name : trace) + printf(" -> %s\n", function_name.characters()); + } interpreter.clear_exception(); return false; }