diff options
author | Linus Groh <mail@linusgroh.de> | 2020-12-06 14:51:56 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-06 18:52:52 +0100 |
commit | 99a6c4ce42b3c44f7a74b9c18d7f3471938c8e32 (patch) | |
tree | 0ff75351bd4c5958fe493045e9bd5c4d5c6e8bb0 /Applications/Spreadsheet | |
parent | abd49c174a65547aa4a48008a31886608e7ffcb9 (diff) | |
download | serenity-99a6c4ce42b3c44f7a74b9c18d7f3471938c8e32.zip |
Spreadsheet: Use JS::Parser::print_errors() for reporting syntax errors
Diffstat (limited to 'Applications/Spreadsheet')
-rw-r--r-- | Applications/Spreadsheet/Spreadsheet.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Applications/Spreadsheet/Spreadsheet.cpp b/Applications/Spreadsheet/Spreadsheet.cpp index 81dc05c7b8..90240cc239 100644 --- a/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Applications/Spreadsheet/Spreadsheet.cpp @@ -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(); } } |