~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/utils/exceptn.cpp

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* (C) 2017 Jack Lloyd
 
3
*
 
4
* Botan is released under the Simplified BSD License (see license.txt)
 
5
*/
 
6
 
 
7
#include <botan/exceptn.h>
 
8
 
 
9
namespace Botan {
 
10
 
 
11
Exception::Exception(const std::string& msg) : m_msg(msg)
 
12
   {}
 
13
 
 
14
Exception::Exception(const char* prefix, const std::string& msg) :
 
15
   m_msg(std::string(prefix) + " " + msg)
 
16
   {}
 
17
 
 
18
Invalid_Argument::Invalid_Argument(const std::string& msg) :
 
19
   Exception("Invalid argument", msg)
 
20
   {}
 
21
 
 
22
Invalid_Argument::Invalid_Argument(const std::string& msg, const std::string& where) :
 
23
   Exception("Invalid argument", msg + " in " + where)
 
24
   {}
 
25
 
 
26
Lookup_Error::Lookup_Error(const std::string& type,
 
27
                           const std::string& algo,
 
28
                           const std::string& provider) :
 
29
   Exception("Unavailable " + type + " " + algo +
 
30
             (provider.empty() ? std::string("") : (" for provider " + provider)))
 
31
   {}
 
32
 
 
33
Internal_Error::Internal_Error(const std::string& err) :
 
34
   Exception("Internal error: " + err)
 
35
   {}
 
36
 
 
37
Invalid_Key_Length::Invalid_Key_Length(const std::string& name, size_t length) :
 
38
   Invalid_Argument(name + " cannot accept a key of length " +
 
39
                    std::to_string(length))
 
40
   {}
 
41
 
 
42
Invalid_IV_Length::Invalid_IV_Length(const std::string& mode, size_t bad_len) :
 
43
   Invalid_Argument("IV length " + std::to_string(bad_len) +
 
44
                    " is invalid for " + mode)
 
45
   {}
 
46
 
 
47
Key_Not_Set::Key_Not_Set(const std::string& algo) :
 
48
   Invalid_State("Key not set in " + algo)
 
49
   {}
 
50
 
 
51
Policy_Violation::Policy_Violation(const std::string& err) :
 
52
   Invalid_State("Policy violation: " + err) {}
 
53
 
 
54
PRNG_Unseeded::PRNG_Unseeded(const std::string& algo) :
 
55
   Invalid_State("PRNG not seeded: " + algo)
 
56
   {}
 
57
 
 
58
Algorithm_Not_Found::Algorithm_Not_Found(const std::string& name) :
 
59
   Lookup_Error("Could not find any algorithm named \"" + name + "\"")
 
60
   {}
 
61
 
 
62
No_Provider_Found::No_Provider_Found(const std::string& name) :
 
63
   Exception("Could not find any provider for algorithm named \"" + name + "\"")
 
64
   {}
 
65
 
 
66
Provider_Not_Found::Provider_Not_Found(const std::string& algo, const std::string& provider) :
 
67
   Lookup_Error("Could not find provider '" + provider + "' for " + algo)
 
68
   {}
 
69
 
 
70
Invalid_Algorithm_Name::Invalid_Algorithm_Name(const std::string& name):
 
71
   Invalid_Argument("Invalid algorithm name: " + name)
 
72
   {}
 
73
 
 
74
Encoding_Error::Encoding_Error(const std::string& name) :
 
75
   Invalid_Argument("Encoding error: " + name)
 
76
   {}
 
77
 
 
78
Decoding_Error::Decoding_Error(const std::string& name) :
 
79
   Invalid_Argument("Decoding error: " + name)
 
80
   {}
 
81
 
 
82
Decoding_Error::Decoding_Error(const std::string& name, const char* exception_message) :
 
83
   Invalid_Argument("Decoding error: " + name + " failed with exception " + exception_message) {}
 
84
 
 
85
Integrity_Failure::Integrity_Failure(const std::string& msg) :
 
86
   Exception("Integrity failure: " + msg)
 
87
   {}
 
88
 
 
89
Invalid_OID::Invalid_OID(const std::string& oid) :
 
90
   Decoding_Error("Invalid ASN.1 OID: " + oid)
 
91
   {}
 
92
 
 
93
Stream_IO_Error::Stream_IO_Error(const std::string& err) :
 
94
   Exception("I/O error: " + err)
 
95
   {}
 
96
 
 
97
Self_Test_Failure::Self_Test_Failure(const std::string& err) :
 
98
   Internal_Error("Self test failed: " + err)
 
99
   {}
 
100
 
 
101
Not_Implemented::Not_Implemented(const std::string& err) :
 
102
   Exception("Not implemented", err)
 
103
   {}
 
104
 
 
105
}