Botan  2.7.0
Crypto and TLS for C++11
assert.cpp
Go to the documentation of this file.
1 /*
2 * Runtime assertion checking
3 * (C) 2010,2012,2018 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #include <botan/exceptn.h>
9 #include <sstream>
10 
11 namespace Botan {
12 
13 void throw_invalid_argument(const char* message,
14  const char* func,
15  const char* file)
16  {
17  std::ostringstream format;
18 
19  format << message << " in " << func << ":" << file;
20 
21  throw Invalid_Argument(format.str());
22  }
23 
24 void assertion_failure(const char* expr_str,
25  const char* assertion_made,
26  const char* func,
27  const char* file,
28  int line)
29  {
30  std::ostringstream format;
31 
32  format << "False assertion ";
33 
34  if(assertion_made && assertion_made[0] != 0)
35  format << "'" << assertion_made << "' (expression " << expr_str << ") ";
36  else
37  format << expr_str << " ";
38 
39  if(func)
40  format << "in " << func << " ";
41 
42  format << "@" << file << ":" << line;
43 
44  throw Exception(format.str());
45  }
46 
47 }
void throw_invalid_argument(const char *message, const char *func, const char *file)
Definition: assert.cpp:13
Definition: alg_id.cpp:13
void assertion_failure(const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
Definition: assert.cpp:24