1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:38:13 +00:00

js: Print call stack on exception thrown outside the global context

This commit is contained in:
Linus Groh 2020-06-02 14:12:04 +01:00 committed by Andreas Kling
parent 4f6912c605
commit 6c89303e7e

View file

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