diff options
author | Jack Lloyd <[email protected]> | 2018-08-22 15:54:04 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-22 15:54:04 -0400 |
commit | 56468f8a389350516de67005c8e780c4f7743aab (patch) | |
tree | f151e3421fe9532087c9b62468e1a02344086478 /src/lib/utils/exceptn.cpp | |
parent | 2fc2598ebab23aa63f7be30c8a2eff6afb262fb3 (diff) |
Simplify exception messages
Remove "Invalid argument" and "Decoding Error" prefixes
Diffstat (limited to 'src/lib/utils/exceptn.cpp')
-rw-r--r-- | src/lib/utils/exceptn.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/utils/exceptn.cpp b/src/lib/utils/exceptn.cpp index a72e45ba4..cc6eb9f85 100644 --- a/src/lib/utils/exceptn.cpp +++ b/src/lib/utils/exceptn.cpp @@ -11,18 +11,25 @@ namespace Botan { Exception::Exception(const std::string& msg) : m_msg(msg) {} +Exception::Exception(const std::string& msg, const std::exception& e) : + m_msg(msg + " failed with " + std::string(e.what())) + {} + Exception::Exception(const char* prefix, const std::string& msg) : m_msg(std::string(prefix) + " " + msg) {} Invalid_Argument::Invalid_Argument(const std::string& msg) : - Exception("Invalid argument", msg) + Exception(msg) {} Invalid_Argument::Invalid_Argument(const std::string& msg, const std::string& where) : - Exception("Invalid argument", msg + " in " + where) + Exception(msg + " in " + where) {} +Invalid_Argument::Invalid_Argument(const std::string& msg, const std::exception& e) : + Exception(msg, e) {} + Lookup_Error::Lookup_Error(const std::string& type, const std::string& algo, const std::string& provider) : @@ -76,11 +83,15 @@ Encoding_Error::Encoding_Error(const std::string& name) : {} Decoding_Error::Decoding_Error(const std::string& name) : - Invalid_Argument("Decoding error: " + name) + Invalid_Argument(name) + {} + +Decoding_Error::Decoding_Error(const std::string& msg, const std::exception& e) : + Invalid_Argument(msg, e) {} Decoding_Error::Decoding_Error(const std::string& name, const char* exception_message) : - Invalid_Argument("Decoding error: " + name + " failed with exception " + exception_message) {} + Invalid_Argument(name + " failed with exception " + exception_message) {} Integrity_Failure::Integrity_Failure(const std::string& msg) : Exception("Integrity failure: " + msg) |