mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
Spreadsheet: Use JS::Parser::print_errors() for reporting syntax errors
This commit is contained in:
parent
abd49c174a
commit
99a6c4ce42
Notes:
sideshowbarker
2024-07-19 01:01:22 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/99a6c4ce42b Pull-request: https://github.com/SerenityOS/serenity/pull/4343
1 changed files with 4 additions and 5 deletions
|
@ -70,15 +70,14 @@ Sheet::Sheet(Workbook& workbook)
|
|||
auto buffer = file_or_error.value()->read_all();
|
||||
JS::Parser parser { JS::Lexer(buffer) };
|
||||
if (parser.has_errors()) {
|
||||
dbgln("Spreadsheet: Failed to parse runtime code");
|
||||
for (auto& error : parser.errors())
|
||||
dbgln("Error: {}\n{}", error.to_string(), error.source_location_hint(buffer));
|
||||
warnln("Spreadsheet: Failed to parse runtime code");
|
||||
parser.print_errors();
|
||||
} else {
|
||||
interpreter().run(global_object(), parser.parse_program());
|
||||
if (auto exc = interpreter().exception()) {
|
||||
dbgln("Spreadsheet: Failed to run runtime code: ");
|
||||
warnln("Spreadsheet: Failed to run runtime code: ");
|
||||
for (auto& t : exc->trace())
|
||||
dbgln("{}", t);
|
||||
warnln("{}", t);
|
||||
interpreter().vm().clear_exception();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue