From 99a6c4ce42b3c44f7a74b9c18d7f3471938c8e32 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 6 Dec 2020 14:51:56 +0000 Subject: Spreadsheet: Use JS::Parser::print_errors() for reporting syntax errors --- Applications/Spreadsheet/Spreadsheet.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Applications/Spreadsheet') 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(); } } -- cgit v1.2.3