error.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // Copyright (c) 2016-2017 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_WEBSOCKET_DETAIL_ERROR_HPP
  10. #define BOOST_BEAST_WEBSOCKET_DETAIL_ERROR_HPP
  11. #include <boost/beast/core/error.hpp>
  12. #include <boost/beast/core/string.hpp>
  13. namespace boost {
  14. namespace beast {
  15. namespace websocket {
  16. enum class error;
  17. enum class condition;
  18. } // websocket
  19. } // beast
  20. namespace system {
  21. template<>
  22. struct is_error_code_enum<beast::websocket::error>
  23. {
  24. static bool const value = true;
  25. };
  26. template<>
  27. struct is_error_condition_enum<beast::websocket::condition>
  28. {
  29. static bool const value = true;
  30. };
  31. } // system
  32. namespace beast {
  33. namespace websocket {
  34. namespace detail {
  35. class error_codes : public error_category
  36. {
  37. public:
  38. const char*
  39. name() const noexcept override;
  40. std::string
  41. message(int ev) const override;
  42. error_condition
  43. default_error_condition(int ev) const noexcept override;
  44. };
  45. class error_conditions : public error_category
  46. {
  47. public:
  48. const char*
  49. name() const noexcept override;
  50. std::string
  51. message(int cv) const override;
  52. };
  53. } // detail
  54. error_code
  55. make_error_code(error e);
  56. error_condition
  57. make_error_condition(condition c);
  58. } // websocket
  59. } // beast
  60. } // boost
  61. #endif