1 #ifndef CPP_PCP_CLIENT_SRC_CONNECTOR_ERRORS_H_
2 #define CPP_PCP_CLIENT_SRC_CONNECTOR_ERRORS_H_
3 
4 #include <stdexcept>
5 #include <string>
6 
7 namespace PCPClient {
8 
9 /// Base error class.
10 class connection_error : public std::runtime_error {
11   public:
connection_error(std::string const & msg)12     explicit connection_error(std::string const& msg)
13             : std::runtime_error(msg) {}
14 };
15 
16 /// Connection fatal error.
17 class connection_fatal_error : public connection_error {
18   public:
connection_fatal_error(std::string const & msg)19     explicit connection_fatal_error(std::string const& msg)
20             : connection_error(msg) {}
21 };
22 
23 /// Connection configuration error.
24 class connection_config_error : public connection_error {
25   public:
connection_config_error(std::string const & msg)26     explicit connection_config_error(std::string const& msg)
27             : connection_error(msg) {}
28 };
29 
30 /// Connection processing error.
31 class connection_processing_error : public connection_error {
32   public:
connection_processing_error(std::string const & msg)33     explicit connection_processing_error(std::string const& msg)
34             : connection_error(msg) {}
35 };
36 
37 /// Connection not initialized error.
38 class connection_not_init_error : public connection_error {
39   public:
connection_not_init_error(std::string const & msg)40     explicit connection_not_init_error(std::string const& msg)
41             : connection_error(msg) {}
42 };
43 
44 /// Connection error due to a timeout or a corrupted message during a
45 /// session association exchange.
46 class connection_association_error : public connection_error {
47   public:
connection_association_error(std::string const & msg)48     explicit connection_association_error(std::string const& msg)
49             : connection_error(msg) {}
50 };
51 
52 /// Connection error due to a Session Association response message
53 /// that reports a failure.
54 class connection_association_response_failure : public connection_error {
55   public:
connection_association_response_failure(std::string const & msg)56     explicit connection_association_response_failure(std::string const& msg)
57             : connection_error(msg) {}
58 };
59 
60 }  // namespace PCPClient
61 
62 #endif  // CPP_PCP_CLIENT_SRC_CONNECTOR_ERRORS_H_
63