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/bigint.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/bigint.cpp')
-rw-r--r-- | checks/bigint.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/checks/bigint.cpp b/checks/bigint.cpp index 8ace987e0..e4fec12b4 100644 --- a/checks/bigint.cpp +++ b/checks/bigint.cpp @@ -5,6 +5,7 @@ #include <cstdlib> #include <botan/bigint.h> +#include <botan/exceptn.h> #include <botan/numthry.h> #include <botan/rng.h> using namespace Botan; @@ -30,10 +31,7 @@ u32bit do_bigint_tests(const std::string& filename) std::ifstream test_data(filename.c_str()); 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; @@ -43,10 +41,8 @@ u32bit do_bigint_tests(const std::string& filename) 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); |