From 9df85d887d0626f39613b25ae737c4cc495b0895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=BD=D0=B0=20=D0=A2=D0=B5=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D1=8C=D0=B5=D0=B2=D0=B0?= Date: Thu, 20 Jun 2024 02:43:49 +0300 Subject: [PATCH] =?UTF-8?q?(#299)=20try-catch=20=D0=B2=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D0=BF=D1=80=D0=B5=D1=82=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/InterpreterApp/src/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/InterpreterApp/src/main.cpp b/apps/InterpreterApp/src/main.cpp index 8fd99c0b..8ae7b974 100644 --- a/apps/InterpreterApp/src/main.cpp +++ b/apps/InterpreterApp/src/main.cpp @@ -14,7 +14,13 @@ int main(int argc, char* argv[]) { std::string load_file = "test.txt"; if (argc > 1) load_file = argv[1]; - if (interpreter.run_file(load_file)) { - interpreter.generate_log("./resources/report.tex"); + try { + if (interpreter.run_file(load_file)) { + interpreter.generate_log("./resources/report.tex"); + } else { + exit(1); + } + } catch (const std::exception& e) { + std::cerr << "Run error: " << e.what() << "\n"; } } \ No newline at end of file