File indexing completed on 2025-01-18 09:29:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_BEAST_TEST_IMPL_ERROR_IPP
0011 #define BOOST_BEAST_TEST_IMPL_ERROR_IPP
0012
0013 #include <boost/beast/_experimental/test/error.hpp>
0014
0015 namespace boost {
0016 namespace beast {
0017 namespace test {
0018
0019 namespace detail {
0020
0021 class error_codes : public error_category
0022 {
0023 public:
0024 BOOST_BEAST_DECL
0025 const char*
0026 name() const noexcept override
0027 {
0028 return "boost.beast.test";
0029 }
0030
0031 BOOST_BEAST_DECL
0032 std::string
0033 message(int ev) const override
0034 {
0035 switch(static_cast<error>(ev))
0036 {
0037 default:
0038 case error::test_failure: return
0039 "An automatic unit test failure occurred";
0040 }
0041 }
0042
0043 BOOST_BEAST_DECL
0044 error_condition
0045 default_error_condition(int ev) const noexcept override
0046 {
0047 return error_condition{ev, *this};
0048 }
0049 };
0050
0051 }
0052
0053 error_code
0054 make_error_code(error e) noexcept
0055 {
0056 static detail::error_codes const cat{};
0057 return error_code{static_cast<
0058 std::underlying_type<error>::type>(e), cat};
0059 }
0060
0061 }
0062 }
0063 }
0064
0065 #endif