diff options
Diffstat (limited to 'src/utils/assert.cpp')
-rw-r--r-- | src/utils/assert.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/utils/assert.cpp b/src/utils/assert.cpp new file mode 100644 index 000000000..29af831d8 --- /dev/null +++ b/src/utils/assert.cpp @@ -0,0 +1,35 @@ +/* +* Runtime assertion checking +* (C) 2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/internal/assert.h> +#include <botan/exceptn.h> +#include <sstream> + +namespace Botan { + +void assertion_failure(const char* expr_str, + const char* msg, + const char* func, + const char* file, + int line) + { + std::ostringstream format; + + format << "Assertion " << expr_str << " failed "; + + if(msg) + format << "(" << msg << ") "; + + if(func) + format << "in " << func << " "; + + format << "@" << file << ":" << line; + + throw Internal_Error(format.str()); + } + +} |