Virgil Security Crypto library  2.0.7
VirgilCryptoException.h
1 
37 #ifndef VIRGIL_CRYPTO_EXCEPTION_H
38 #define VIRGIL_CRYPTO_EXCEPTION_H
39 
40 #include <string>
41 #include <stdexcept>
42 #include <system_error>
43 
44 namespace virgil { namespace crypto {
45 
54 class VirgilCryptoException : public std::exception {
55 public:
61  VirgilCryptoException(int ev, const std::error_category& ecat);
62 
69  VirgilCryptoException(int ev, const std::error_category& ecat, const std::string& what);
70 
77  VirgilCryptoException(int ev, const std::error_category& ecat, const char* what);
78 
84  const std::error_condition& condition() const;
85 
91  const char* what() const noexcept override;
92 private:
93  std::error_condition condition_;
94  std::string what_;
95 };
96 
103 std::string backtrace_exception(const std::exception& exception, size_t level = 0);
104 
105 }}
106 
108 // TODO: Remove this when Clang compiler will be used from the Android NDK, possible in the release r13.
109 #if defined(ANDROID) && defined(__GCC_ATOMIC_INT_LOCK_FREE) && __GCC_ATOMIC_INT_LOCK_FREE < 2
110 namespace std {
111 template<typename T>
112 void throw_with_nested(const T& ex) {
113  throw ex;
114 }
115 template<typename T>
116 void rethrow_if_nested(const T&) {
117  // Do nothing
118 }
119 }
120 #endif
121 
123 
124 #endif /* VIRGIL_CRYPTO_EXCEPTION_H */
Definition: VirgilHash.h:252
VirgilCryptoException(int ev, const std::error_category &ecat)
Initialize Exception with specific error code and correspond error category.
Root namespace for all Virgil Security libraries.
Definition: VirgilAsn1Compatible.h:46
std::string backtrace_exception(const std::exception &exception, size_t level=0)
Unwind information about nested excpetions.
const std::error_condition & condition() const
This only exception that crypto library can produce.
Definition: VirgilCryptoException.h:54
const char * what() const noexcept override