From a9fa7d33c5b4d5465263cccf884a83fa95dfb0a5 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 25 Nov 2014 08:59:26 +0100 Subject: [PATCH] autfilt: diagnose non-existant files * src/bin/autfilt.cc: Catch exception. * src/tgbatest/hoaparse.test: Test it. --- src/bin/autfilt.cc | 11 +++++++++-- src/tgbatest/hoaparse.test | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bin/autfilt.cc b/src/bin/autfilt.cc index 196e05c5a..ff8b9bf56 100644 --- a/src/bin/autfilt.cc +++ b/src/bin/autfilt.cc @@ -391,7 +391,14 @@ main(int argc, char** argv) post.set_level(level); hoa_processor processor(post); - if (processor.run()) - return 2; + try + { + if (processor.run()) + return 2; + } + catch (const std::runtime_error& e) + { + error(2, 0, "%s", e.what()); + } return 0; } diff --git a/src/tgbatest/hoaparse.test b/src/tgbatest/hoaparse.test index a7258ac4d..34d61bc3a 100755 --- a/src/tgbatest/hoaparse.test +++ b/src/tgbatest/hoaparse.test @@ -717,3 +717,7 @@ input:4.7-242: unclosed string input:4.7-242: syntax error, unexpected end of file, expecting string autfilt: failed to read automaton from input EOF + +expecterr non-existant<