1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9 
10 #ifndef BOOST_BEAST_ERROR_HPP
11 #define BOOST_BEAST_ERROR_HPP
12 
13 #include <boost/beast/core/detail/config.hpp>
14 #include <boost/system/error_code.hpp>
15 #include <boost/system/system_error.hpp>
16 
17 namespace boost {
18 namespace beast {
19 
20 /// The type of error code used by the library
21 using error_code = boost::system::error_code;
22 
23 /// The type of system error thrown by the library
24 using system_error = boost::system::system_error;
25 
26 /// The type of error category used by the library
27 using error_category = boost::system::error_category;
28 
29 /// A function to return the generic error category used by the library
30 #if BOOST_BEAST_DOXYGEN
31 error_category const&
32 generic_category();
33 #else
34 using boost::system::generic_category;
35 #endif
36 
37 /// A function to return the system error category used by the library
38 #if BOOST_BEAST_DOXYGEN
39 error_category const&
40 system_category();
41 #else
42 using boost::system::system_category;
43 #endif
44 
45 /// The type of error condition used by the library
46 using error_condition = boost::system::error_condition;
47 
48 /// The set of constants used for cross-platform error codes
49 #if BOOST_BEAST_DOXYGEN
50 enum errc{};
51 #else
52 namespace errc = boost::system::errc;
53 #endif
54 
55 //------------------------------------------------------------------------------
56 
57 /// Error codes returned from library operations
58 enum class error
59 {
60     /** The socket was closed due to a timeout
61 
62         This error indicates that a socket was closed due to a
63         a timeout detected during an operation.
64 
65         Error codes with this value will compare equal to @ref condition::timeout.
66     */
67     timeout = 1
68 };
69 
70 /// Error conditions corresponding to sets of library error codes.
71 enum class condition
72 {
73     /** The operation timed out
74 
75         This error indicates that an operation took took too long.
76     */
77     timeout = 1
78 };
79 
80 } // beast
81 } // boost
82 
83 #include <boost/beast/core/impl/error.hpp>
84 #ifdef BOOST_BEAST_HEADER_ONLY
85 #include <boost/beast/core/impl/error.ipp>
86 #endif
87 
88 #endif
89