| Line | Branch | Exec | Source |
|---|---|---|---|
| 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_proto | ||
| 8 | // | ||
| 9 | |||
| 10 | #ifndef BOOST_HTTP_PROTO_DETAIL_IMPL_EXCEPT_IPP | ||
| 11 | #define BOOST_HTTP_PROTO_DETAIL_IMPL_EXCEPT_IPP | ||
| 12 | |||
| 13 | #include <boost/http_proto/detail/except.hpp> | ||
| 14 | #include <boost/system/system_error.hpp> | ||
| 15 | #include <boost/version.hpp> | ||
| 16 | #include <boost/throw_exception.hpp> | ||
| 17 | #include <stdexcept> | ||
| 18 | |||
| 19 | namespace boost { | ||
| 20 | namespace http_proto { | ||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | void | ||
| 24 | ✗ | throw_bad_alloc( | |
| 25 | source_location const& loc) | ||
| 26 | { | ||
| 27 | ✗ | throw_exception( | |
| 28 | ✗ | std::bad_alloc(), loc); | |
| 29 | } | ||
| 30 | |||
| 31 | void | ||
| 32 | 8 | throw_invalid_argument( | |
| 33 | source_location const& loc) | ||
| 34 | { | ||
| 35 | 8 | throw_exception( | |
| 36 | 16 | std::invalid_argument( | |
| 37 | "invalid argument"), | ||
| 38 | loc); | ||
| 39 | } | ||
| 40 | |||
| 41 | void | ||
| 42 | ✗ | throw_invalid_argument( | |
| 43 | char const* what, | ||
| 44 | source_location const& loc) | ||
| 45 | { | ||
| 46 | ✗ | throw_exception( | |
| 47 | ✗ | std::invalid_argument(what), loc); | |
| 48 | } | ||
| 49 | |||
| 50 | void | ||
| 51 | 4 | throw_length_error( | |
| 52 | source_location const& loc) | ||
| 53 | { | ||
| 54 | 4 | throw_exception( | |
| 55 | 8 | std::length_error( | |
| 56 | "length error"), loc); | ||
| 57 | } | ||
| 58 | |||
| 59 | void | ||
| 60 | ✗ | throw_length_error( | |
| 61 | char const* what, | ||
| 62 | source_location const& loc) | ||
| 63 | { | ||
| 64 | ✗ | throw_exception( | |
| 65 | ✗ | std::length_error(what), loc); | |
| 66 | } | ||
| 67 | |||
| 68 | void | ||
| 69 | 15 | throw_logic_error( | |
| 70 | source_location const& loc) | ||
| 71 | { | ||
| 72 | 15 | throw_exception( | |
| 73 | 30 | std::logic_error( | |
| 74 | "logic error"), | ||
| 75 | loc); | ||
| 76 | } | ||
| 77 | |||
| 78 | void | ||
| 79 | ✗ | throw_out_of_range( | |
| 80 | source_location const& loc) | ||
| 81 | { | ||
| 82 | ✗ | throw_exception( | |
| 83 | ✗ | std::out_of_range("out of range"), loc); | |
| 84 | } | ||
| 85 | |||
| 86 | void | ||
| 87 | ✗ | throw_runtime_error( | |
| 88 | char const* what, | ||
| 89 | source_location const& loc) | ||
| 90 | { | ||
| 91 | ✗ | throw_exception( | |
| 92 | ✗ | std::runtime_error(what), loc); | |
| 93 | } | ||
| 94 | |||
| 95 | void | ||
| 96 | ✗ | throw_system_error( | |
| 97 | system::error_code const& ec, | ||
| 98 | source_location const& loc) | ||
| 99 | { | ||
| 100 | ✗ | throw_exception( | |
| 101 | ✗ | system::system_error(ec), loc); | |
| 102 | } | ||
| 103 | |||
| 104 | void | ||
| 105 | ✗ | throw_system_error( | |
| 106 | error e, | ||
| 107 | source_location const& loc) | ||
| 108 | { | ||
| 109 | ✗ | throw_exception( | |
| 110 | ✗ | system::system_error(e), loc); | |
| 111 | } | ||
| 112 | |||
| 113 | } // detail | ||
| 114 | } // http_proto | ||
| 115 | } // boost | ||
| 116 | |||
| 117 | #endif | ||
| 118 |