aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/asio/asio_convert_exceptions.h
blob: 3a054be1092d5d8b48e7aac973c7b3dc9a853ba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef BOTAN_ASIO_CONVERT_EXCEPTIONS_H_
#define BOTAN_ASIO_CONVERT_EXCEPTIONS_H_

#include <botan/asio_error.h>
#include <botan/tls_exceptn.h>

namespace Botan {
inline boost::system::error_code convertException()
   {
   try
      {
      throw;
      }
   catch(Botan::TLS::Unexpected_Message& e)
      {
      return make_error_code(Botan::error::unexpected_message);
      }
   catch(Botan::TLS::TLS_Exception& e)
      {
      return make_error_code(e.type());
      }
   catch(Botan::Unsupported_Argument& e)
      {
      return make_error_code(Botan::error::unsupported_argument);
      }
   catch(Botan::Invalid_Key_Length& e)
      {
      return make_error_code(Botan::error::invalid_key_length);
      }
   catch(Botan::Invalid_IV_Length& e)
      {
      return make_error_code(Botan::error::invalid_iv_length);
      }
   catch(Botan::Invalid_Algorithm_Name& e)
      {
      return make_error_code(Botan::error::invalid_algorithm_name);
      }
   catch(Botan::Encoding_Error& e)
      {
      return make_error_code(Botan::error::encoding_error);
      }
   catch(Botan::Invalid_OID& e)
      {
      return make_error_code(Botan::error::invalid_oid);
      }
   catch(Botan::Decoding_Error& e)
      {
      return make_error_code(Botan::error::decoding_error);
      }
   catch(Botan::Invalid_Argument& e)
      {
      return make_error_code(Botan::error::invalid_argument);
      }
   catch(Botan::Key_Not_Set& e)
      {
      return make_error_code(Botan::error::key_not_set);
      }
   catch(Botan::PRNG_Unseeded& e)
      {
      return make_error_code(Botan::error::prng_unseeded);
      }
   catch(Botan::Policy_Violation& e)
      {
      return make_error_code(Botan::error::policy_violation);
      }
   catch(Botan::Invalid_State& e)
      {
      return make_error_code(Botan::error::invalid_state);
      }
   catch(Botan::Algorithm_Not_Found& e)
      {
      return make_error_code(Botan::error::algorithm_not_found);
      }
   catch(Botan::Provider_Not_Found& e)
      {
      return make_error_code(Botan::error::provider_not_found);
      }
   catch(Botan::Lookup_Error& e)
      {
      return make_error_code(Botan::error::lookup_error);
      }
   catch(Botan::Self_Test_Failure& e)
      {
      return make_error_code(Botan::error::self_test_failure);
      }
   catch(Botan::Internal_Error& e)
      {
      return make_error_code(Botan::error::internal_error);
      }
   catch(Botan::No_Provider_Found& e)
      {
      return make_error_code(Botan::error::no_provider_found);
      }
   catch(Botan::Integrity_Failure& e)
      {
      return make_error_code(Botan::error::integrity_failure);
      }
   catch(Botan::Stream_IO_Error& e)
      {
      return make_error_code(Botan::error::stream_io_error);
      }
   catch(Botan::Not_Implemented& e)
      {
      return make_error_code(Botan::error::not_implemented);
      }
   catch(Botan::Exception& e)
      {
      return make_error_code(Botan::error::unknown);
      }
   catch(std::exception& e)
      {
      return make_error_code(Botan::error::unknown);
      }
   }
}

#endif