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