5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_IMPL_ERROR_IPP
12 #define BOOST_ASIO_IMPL_ERROR_IPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #include <boost/asio/error.hpp>
22 #include <boost/asio/detail/push_options.hpp>
28 #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
32 class netdb_category : public boost::system::error_category
35 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
40 std::string message(int value) const
42 if (value == error::host_not_found)
43 return "Host not found (authoritative)";
44 if (value == error::host_not_found_try_again)
45 return "Host not found (non-authoritative), try again later";
46 if (value == error::no_data)
47 return "The query is valid, but it does not have associated data";
48 if (value == error::no_recovery)
49 return "A non-recoverable error occurred during database lookup";
50 return "asio.netdb error";
56 const boost::system::error_category& get_netdb_category()
58 static detail::netdb_category instance;
64 class addrinfo_category : public boost::system::error_category
67 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
69 return "asio.addrinfo";
72 std::string message(int value) const
74 if (value == error::service_not_found)
75 return "Service not found";
76 if (value == error::socket_type_not_supported)
77 return "Socket type not supported";
78 return "asio.addrinfo error";
84 const boost::system::error_category& get_addrinfo_category()
86 static detail::addrinfo_category instance;
90 #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
94 class misc_category : public boost::system::error_category
97 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
102 std::string message(int value) const
104 if (value == error::already_open)
105 return "Already open";
106 if (value == error::eof)
107 return "End of file";
108 if (value == error::not_found)
109 return "Element not found";
110 if (value == error::fd_set_failure)
111 return "The descriptor does not fit into the select call's fd_set";
112 return "asio.misc error";
116 } // namespace detail
118 const boost::system::error_category& get_misc_category()
120 static detail::misc_category instance;
128 #include <boost/asio/detail/pop_options.hpp>
130 #endif // BOOST_ASIO_IMPL_ERROR_IPP