diff options
author | lloyd <[email protected]> | 2007-02-19 23:42:37 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-02-19 23:42:37 +0000 |
commit | 8253bc1e62ea10b80b4bbfdc8e95c8849237cda2 (patch) | |
tree | c05937e167cf6629d34404b5d0073fb39eca3c3f /checks/validate.cpp | |
parent | 54b95e6be5d3788497d461674869c0e0efc6e15c (diff) |
Eliminate most uses of exit() to bail on an error; instead throw an
exception upto the top level, that's what it's there for.
Diffstat (limited to 'checks/validate.cpp')
-rw-r--r-- | checks/validate.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/checks/validate.cpp b/checks/validate.cpp index 2bdd6181b..b10b53b98 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -9,6 +9,7 @@ #include <cstdlib> #include <botan/filters.h> +#include <botan/exceptn.h> #include <botan/rng.h> using namespace Botan_types; @@ -51,10 +52,7 @@ u32bit do_validation_tests(const std::string& filename, bool should_pass) bool first_mark = true; if(!test_data) - { - std::cout << "Couldn't open test file " << filename << std::endl; - std::exit(1); - } + throw Botan::Stream_IO_Error("Couldn't open test file " + filename); u32bit errors = 0, alg_count = 0; std::string algorithm; @@ -66,10 +64,8 @@ u32bit do_validation_tests(const std::string& filename, bool should_pass) while(!test_data.eof()) { if(test_data.bad() || test_data.fail()) - { - std::cout << "File I/O error." << std::endl; - std::exit(1); - } + throw Botan::Stream_IO_Error("File I/O error reading from " + + filename); std::string line; std::getline(test_data, line); @@ -271,10 +267,7 @@ bool failed_test(const std::string& algo, OK = false; if(!OK) - { - std::cout << "Peek testing failed!" << std::endl; - std::exit(1); - } + throw Botan::Self_Test_Failure("Peek testing failed in validate.cpp"); } if(output == expected && !exp_pass) |