Userland/JS: Print any exceptions after execution of a JS file

This commit is contained in:
Dov Alperin 2020-04-02 10:55:37 -04:00 committed by Andreas Kling
parent 6bf47252dc
commit 3906d2b46a
Notes: sideshowbarker 2024-07-19 07:59:22 +09:00

View File

@ -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;