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