diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 4b80b8e9ac..6339ecf53a 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -495,13 +495,16 @@ static bool parse_and_run(JS::Interpreter& interpreter, const StringView& source } vm->clear_exception(); }; - if (vm->exception()) - handle_exception(); - if (s_print_last_result) { + if (vm->exception()) { + handle_exception(); + return false; + } + if (s_print_last_result) print(vm->last_value()); - if (vm->exception()) - handle_exception(); + if (vm->exception()) { + return false; + handle_exception(); } return true; }