diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-12 14:22:35 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-12 14:22:35 +0200 |
commit | 94ef7627456fd93c343c6516d1f235a27e54a082 (patch) | |
tree | c4892a63108733ff8673dbe02bfd0274b9651111 | |
parent | b5831ee54e8f6f6127b5cd5992f387e40009d250 (diff) |
WIP broken exception handler
-rw-r--r-- | Parser.cpp | 7 | ||||
-rw-r--r-- | main.cpp | 3 |
2 files changed, 6 insertions, 4 deletions
@@ -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()); + } } } @@ -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 { |