Botan  2.8.0
Crypto and TLS for C++11
exceptn.h
Go to the documentation of this file.
1 /*
2 * Exceptions
3 * (C) 1999-2009 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_EXCEPTION_H_
9 #define BOTAN_EXCEPTION_H_
10 
11 #include <botan/types.h>
12 #include <exception>
13 #include <string>
14 
15 namespace Botan {
16 
17 /**
18 * Base class for all exceptions thrown by the library
19 */
20 class BOTAN_PUBLIC_API(2,0) Exception : public std::exception
21  {
22  public:
23  Exception(const char* prefix, const std::string& msg);
24  explicit Exception(const std::string& msg);
25  const char* what() const BOTAN_NOEXCEPT override { return m_msg.c_str(); }
26  protected:
27  Exception(const std::string& msg, const std::exception& e);
28  private:
29  std::string m_msg;
30  };
31 
32 /**
33 * An invalid argument
34 */
36  {
37  public:
38  explicit Invalid_Argument(const std::string& msg);
39 
40  explicit Invalid_Argument(const std::string& msg, const std::string& where);
41 
42  Invalid_Argument(const std::string& msg, const std::exception& e);
43  };
44 
45 /**
46 * Unsupported_Argument Exception
47 *
48 * An argument that is invalid because it is not supported by Botan.
49 * It might or might not be valid in another context like a standard.
50 */
52  {
53  public:
54  explicit Unsupported_Argument(const std::string& msg) : Invalid_Argument(msg) {}
55  };
56 
57 /**
58 * Invalid_State Exception
59 */
61  {
62  public:
63  explicit Invalid_State(const std::string& err) : Exception(err) {}
64  };
65 
67  {
68  public:
69  explicit Key_Not_Set(const std::string& algo);
70  };
71 
72 /**
73 * Lookup_Error Exception
74 */
76  {
77  public:
78  explicit Lookup_Error(const std::string& err) : Exception(err) {}
79 
80  Lookup_Error(const std::string& type,
81  const std::string& algo,
82  const std::string& provider);
83  };
84 
85 /**
86 * Internal_Error Exception
87 */
89  {
90  public:
91  explicit Internal_Error(const std::string& err);
92  };
93 
94 /**
95 * Invalid_Key_Length Exception
96 */
98  {
99  public:
100  Invalid_Key_Length(const std::string& name, size_t length);
101  };
102 
103 /**
104 * Invalid_IV_Length Exception
105 */
107  {
108  public:
109  Invalid_IV_Length(const std::string& mode, size_t bad_len);
110  };
111 
112 /**
113 * PRNG_Unseeded Exception
114 */
116  {
117  public:
118  explicit PRNG_Unseeded(const std::string& algo);
119  };
120 
121 /**
122 * Policy_Violation Exception
123 */
125  {
126  public:
127  BOTAN_DEPRECATED("deprecated") explicit Policy_Violation(const std::string& err);
128  };
129 
130 /**
131 * Algorithm_Not_Found Exception
132 */
134  {
135  public:
136  explicit Algorithm_Not_Found(const std::string& name);
137  };
138 
139 /**
140 * No_Provider_Found Exception
141 */
143  {
144  public:
145  BOTAN_DEPRECATED("deprecated") explicit No_Provider_Found(const std::string& name);
146  };
147 
148 /**
149 * Provider_Not_Found is thrown when a specific provider was requested
150 * but that provider is not available.
151 */
153  {
154  public:
155  Provider_Not_Found(const std::string& algo, const std::string& provider);
156  };
157 
158 /**
159 * Invalid_Algorithm_Name Exception
160 */
162  {
163  public:
164  explicit Invalid_Algorithm_Name(const std::string& name);
165  };
166 
167 /**
168 * Encoding_Error Exception
169 */
171  {
172  public:
173  explicit Encoding_Error(const std::string& name);
174  };
175 
176 /**
177 * Decoding_Error Exception
178 */
180  {
181  public:
182  explicit Decoding_Error(const std::string& name);
183 
184  Decoding_Error(const std::string& name, const char* exception_message);
185 
186  Decoding_Error(const std::string& msg, const std::exception& e);
187  };
188 
189 /**
190 * Integrity_Failure Exception
191 */
193  {
194  public:
195  explicit Integrity_Failure(const std::string& msg);
196  };
197 
198 /**
199 * Invalid_OID Exception
200 */
202  {
203  public:
204  explicit Invalid_OID(const std::string& oid);
205  };
206 
207 /**
208 * Stream_IO_Error Exception
209 */
211  {
212  public:
213  explicit Stream_IO_Error(const std::string& err);
214  };
215 
216 /**
217 * Self Test Failure Exception
218 */
220  {
221  public:
222  BOTAN_DEPRECATED("deprecated") explicit Self_Test_Failure(const std::string& err);
223  };
224 
225 /**
226 * Not Implemented Exception
227 */
229  {
230  public:
231  explicit Not_Implemented(const std::string& err);
232  };
233 
234 }
235 
236 #endif
Invalid_State(const std::string &err)
Definition: exceptn.h:63
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
MechanismType type
#define BOTAN_NOEXCEPT
Definition: compiler.h:154
Unsupported_Argument(const std::string &msg)
Definition: exceptn.h:54
std::string name
const char * what() const BOTAN_NOEXCEPT override
Definition: exceptn.h:25
Definition: alg_id.cpp:13
Lookup_Error(const std::string &err)
Definition: exceptn.h:78