error.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef BOOST_BEAST_ERROR_HPP
  10. #define BOOST_BEAST_ERROR_HPP
  11. #include <boost/beast/core/detail/config.hpp>
  12. #include <boost/system/error_code.hpp>
  13. #include <boost/system/system_error.hpp>
  14. namespace boost {
  15. namespace beast {
  16. /// The type of error code used by the library
  17. using error_code = boost::system::error_code;
  18. /// The type of system error thrown by the library
  19. using system_error = boost::system::system_error;
  20. /// The type of error category used by the library
  21. using error_category = boost::system::error_category;
  22. /// A function to return the generic error category used by the library
  23. #if BOOST_BEAST_DOXYGEN
  24. error_category const&
  25. generic_category();
  26. #else
  27. using boost::system::generic_category;
  28. #endif
  29. /// A function to return the system error category used by the library
  30. #if BOOST_BEAST_DOXYGEN
  31. error_category const&
  32. system_category();
  33. #else
  34. using boost::system::system_category;
  35. #endif
  36. /// The type of error condition used by the library
  37. using error_condition = boost::system::error_condition;
  38. /// The set of constants used for cross-platform error codes
  39. #if BOOST_BEAST_DOXYGEN
  40. enum errc{};
  41. #else
  42. namespace errc = boost::system::errc;
  43. #endif
  44. //------------------------------------------------------------------------------
  45. /// Error codes returned from library operations
  46. enum class error
  47. {
  48. /** The socket was closed due to a timeout
  49. This error indicates that a socket was closed due to a
  50. a timeout detected during an operation.
  51. Error codes with this value will compare equal to @ref condition::timeout.
  52. */
  53. timeout = 1
  54. };
  55. /// Error conditions corresponding to sets of library error codes.
  56. enum class condition
  57. {
  58. /** The operation timed out
  59. This error indicates that an operation took took too long.
  60. */
  61. timeout = 1
  62. };
  63. } // beast
  64. } // boost
  65. #include <boost/beast/core/impl/error.hpp>
  66. #ifdef BOOST_BEAST_HEADER_ONLY
  67. #include <boost/beast/core/impl/error.ipp>
  68. #endif
  69. #endif