From 94ef7627456fd93c343c6516d1f235a27e54a082 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 12 Jun 2024 14:22:35 +0200 Subject: WIP broken exception handler --- Parser.cpp | 7 ++++++- main.cpp | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Parser.cpp b/Parser.cpp index c8a90b4..50833d8 100644 --- a/Parser.cpp +++ b/Parser.cpp @@ -60,7 +60,12 @@ void Parser::parse(istream & input) { } if (circuit == nullptr) throw ParserException("circuit is not initialized!"); - circuit->create(label, nodes); + + try { + circuit->create(label, nodes); + } catch(CircuitException & c) { + throw ParserException("Circuit error on line %u: %s", linenum, c.what()); + } } } diff --git a/main.cpp b/main.cpp index aab566c..e2721b1 100644 --- a/main.cpp +++ b/main.cpp @@ -22,9 +22,6 @@ int main(int argc, char** argv) { } catch (ParserException & e) { cout << "Parser error: " << e.what() << endl; return EXIT_FAILURE; - } catch (CircuitException & e) { - cout << "Circuit error: " << e.what() << endl; - return EXIT_FAILURE; } try { -- cgit v1.2.3