src/error.cpp

0.0% Lines (0/7) 0.0% List of functions (0/2) 0.0% Branches (0/4)
error.cpp
f(x) Functions (2)
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2025 Vinnie Falco ([email protected])
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/cppalliance/beast2
8 //
9
10 #include <boost/beast2/error.hpp>
11
12 namespace boost {
13 namespace beast2 {
14
15 namespace detail {
16
17 const char*
18 ✗ error_cat_type::
19 name() const noexcept
20 {
21 ✗ return "boost.beast2";
22 }
23
24 std::string
25 ✗ error_cat_type::
26 message(int code) const
27 {
28 ✗ switch(static_cast<error>(code))
29 {
30 ✗ case error::success: return "beast2::error::success";
31 ✗ default:
32 ✗ return "beast2::error::?";
33 }
34 }
35
36 //-----------------------------------------------
37
38 // msvc 14.0 has a bug that warns about inability
39 // to use constexpr construction here, even though
40 // there's no constexpr construction
41 #if defined(_MSC_VER) && _MSC_VER <= 1900
42 # pragma warning( push )
43 # pragma warning( disable : 4592 )
44 #endif
45
46 #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
47 constinit error_cat_type error_cat;
48 #else
49 error_cat_type error_cat;
50 #endif
51
52 #if defined(_MSC_VER) && _MSC_VER <= 1900
53 # pragma warning( pop )
54 #endif
55
56 } // detail
57
58 } // beast2
59 } // boost
60