File indexing completed on 2025-07-02 08:07:09
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 char const*
0033 message(int ev, char*, std::size_t) const noexcept 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 std::string
0045 message(int ev) const override
0046 {
0047 return message(ev, nullptr, 0);
0048 }
0049
0050 BOOST_BEAST_DECL
0051 error_condition
0052 default_error_condition(int ev) const noexcept override
0053 {
0054 return error_condition{ev, *this};
0055 }
0056 };
0057
0058 }
0059
0060 error_code
0061 make_error_code(error e) noexcept
0062 {
0063 static detail::error_codes const cat{};
0064 return error_code{static_cast<
0065 std::underlying_type<error>::type>(e), cat};
0066 }
0067
0068 }
0069 }
0070 }
0071
0072 #endif