From 3906d2b46ab54643d43cbdeeba97ecf72ec97697 Mon Sep 17 00:00:00 2001 From: Dov Alperin Date: Thu, 2 Apr 2020 10:55:37 -0400 Subject: [PATCH] Userland/JS: Print any exceptions after execution of a JS file --- Userland/js.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/js.cpp b/Userland/js.cpp index 089ee322a6..f64ca74cf4 100644 --- a/Userland/js.cpp +++ b/Userland/js.cpp @@ -335,8 +335,13 @@ int main(int argc, char** argv) auto result = interpreter->run(*program); - if (print_last_result) + if (interpreter->exception()) { + printf("Uncaught exception: "); + print(interpreter->exception()->value()); + interpreter->clear_exception(); + } else if (print_last_result) { printf("%s\n", result.to_string().characters()); + } } return 0;