src/detail/except.cpp
63.6% Lines (21/33)
63.6% List of functions (7/11)
Functions (11)
Function
Calls
Lines
Blocks
boost::http::detail::throw_bad_alloc(boost::source_location const&)
:22
0
0.0%
0.0%
boost::http::detail::throw_bad_typeid(boost::source_location const&)
:30
1x
100.0%
100.0%
boost::http::detail::throw_invalid_argument(boost::source_location const&)
:38
27x
100.0%
100.0%
boost::http::detail::throw_invalid_argument(char const*, boost::source_location const&)
:48
4x
100.0%
100.0%
boost::http::detail::throw_length_error(boost::source_location const&)
:57
23x
100.0%
100.0%
boost::http::detail::throw_length_error(char const*, boost::source_location const&)
:66
1x
100.0%
100.0%
boost::http::detail::throw_logic_error(boost::source_location const&)
:75
21x
100.0%
100.0%
boost::http::detail::throw_out_of_range(boost::source_location const&)
:85
0
0.0%
0.0%
boost::http::detail::throw_runtime_error(char const*, boost::source_location const&)
:93
0
0.0%
0.0%
boost::http::detail::throw_system_error(boost::system::error_code const&, boost::source_location const&)
:102
23x
100.0%
100.0%
boost::http::detail::throw_system_error(boost::http::error, boost::source_location const&)
:111
0
0.0%
0.0%
| Line | TLA | Hits | Source Code |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.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/cppalliance/http | ||
| 8 | // | ||
| 9 | |||
| 10 | #include <boost/http/detail/except.hpp> | ||
| 11 | #include <boost/system/system_error.hpp> | ||
| 12 | #include <boost/version.hpp> | ||
| 13 | #include <boost/throw_exception.hpp> | ||
| 14 | #include <stdexcept> | ||
| 15 | #include <typeinfo> | ||
| 16 | |||
| 17 | namespace boost { | ||
| 18 | namespace http { | ||
| 19 | namespace detail { | ||
| 20 | |||
| 21 | void | ||
| 22 | ✗ | throw_bad_alloc( | |
| 23 | source_location const& loc) | ||
| 24 | { | ||
| 25 | ✗ | throw_exception( | |
| 26 | ✗ | std::bad_alloc(), loc); | |
| 27 | } | ||
| 28 | |||
| 29 | void | ||
| 30 | 1x | throw_bad_typeid( | |
| 31 | source_location const& loc) | ||
| 32 | { | ||
| 33 | 1x | throw_exception( | |
| 34 | 2x | std::bad_typeid(), loc); | |
| 35 | } | ||
| 36 | |||
| 37 | void | ||
| 38 | 27x | throw_invalid_argument( | |
| 39 | source_location const& loc) | ||
| 40 | { | ||
| 41 | 27x | throw_exception( | |
| 42 | 54x | std::invalid_argument( | |
| 43 | "invalid argument"), | ||
| 44 | loc); | ||
| 45 | } | ||
| 46 | |||
| 47 | void | ||
| 48 | 4x | throw_invalid_argument( | |
| 49 | char const* what, | ||
| 50 | source_location const& loc) | ||
| 51 | { | ||
| 52 | 4x | throw_exception( | |
| 53 | 8x | std::invalid_argument(what), loc); | |
| 54 | } | ||
| 55 | |||
| 56 | void | ||
| 57 | 23x | throw_length_error( | |
| 58 | source_location const& loc) | ||
| 59 | { | ||
| 60 | 23x | throw_exception( | |
| 61 | 46x | std::length_error( | |
| 62 | "length error"), loc); | ||
| 63 | } | ||
| 64 | |||
| 65 | void | ||
| 66 | 1x | throw_length_error( | |
| 67 | char const* what, | ||
| 68 | source_location const& loc) | ||
| 69 | { | ||
| 70 | 1x | throw_exception( | |
| 71 | 2x | std::length_error(what), loc); | |
| 72 | } | ||
| 73 | |||
| 74 | void | ||
| 75 | 21x | throw_logic_error( | |
| 76 | source_location const& loc) | ||
| 77 | { | ||
| 78 | 21x | throw_exception( | |
| 79 | 42x | std::logic_error( | |
| 80 | "logic error"), | ||
| 81 | loc); | ||
| 82 | } | ||
| 83 | |||
| 84 | void | ||
| 85 | ✗ | throw_out_of_range( | |
| 86 | source_location const& loc) | ||
| 87 | { | ||
| 88 | ✗ | throw_exception( | |
| 89 | ✗ | std::out_of_range("out of range"), loc); | |
| 90 | } | ||
| 91 | |||
| 92 | void | ||
| 93 | ✗ | throw_runtime_error( | |
| 94 | char const* what, | ||
| 95 | source_location const& loc) | ||
| 96 | { | ||
| 97 | ✗ | throw_exception( | |
| 98 | ✗ | std::runtime_error(what), loc); | |
| 99 | } | ||
| 100 | |||
| 101 | void | ||
| 102 | 23x | throw_system_error( | |
| 103 | system::error_code const& ec, | ||
| 104 | source_location const& loc) | ||
| 105 | { | ||
| 106 | 23x | throw_exception( | |
| 107 | 46x | system::system_error(ec), loc); | |
| 108 | } | ||
| 109 | |||
| 110 | void | ||
| 111 | ✗ | throw_system_error( | |
| 112 | error e, | ||
| 113 | source_location const& loc) | ||
| 114 | { | ||
| 115 | ✗ | throw_exception( | |
| 116 | ✗ | system::system_error(e), loc); | |
| 117 | } | ||
| 118 | |||
| 119 | } // detail | ||
| 120 | } // http | ||
| 121 | } // boost | ||
| 122 |