libs/capy/src/detail/except.cpp
20.0% Lines (4/20)
20.0% Functions (2/10)
25.0% Branches (2/8)
libs/capy/src/detail/except.cpp
| Line | Branch | Hits | Source Code |
|---|---|---|---|
| 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 <system_error> | ||
| 13 | #include <stdexcept> | ||
| 14 | #include <typeinfo> | ||
| 15 | |||
| 16 | namespace boost { | ||
| 17 | namespace capy { | ||
| 18 | namespace detail { | ||
| 19 | |||
| 20 | void | ||
| 21 | ✗ | throw_bad_typeid() | |
| 22 | { | ||
| 23 | ✗ | throw std::bad_typeid(); | |
| 24 | } | ||
| 25 | |||
| 26 | void | ||
| 27 | ✗ | throw_bad_alloc() | |
| 28 | { | ||
| 29 | ✗ | throw std::bad_alloc(); | |
| 30 | } | ||
| 31 | |||
| 32 | void | ||
| 33 | 10 | throw_invalid_argument() | |
| 34 | { | ||
| 35 | throw std::invalid_argument( | ||
| 36 |
1/1✓ Branch 2 taken 10 times.
|
10 | "invalid argument"); |
| 37 | } | ||
| 38 | |||
| 39 | void | ||
| 40 | ✗ | throw_invalid_argument( | |
| 41 | char const* what) | ||
| 42 | { | ||
| 43 | ✗ | throw std::invalid_argument(what); | |
| 44 | } | ||
| 45 | |||
| 46 | void | ||
| 47 | 1 | throw_length_error() | |
| 48 | { | ||
| 49 | throw std::length_error( | ||
| 50 |
1/1✓ Branch 2 taken 1 time.
|
1 | "length error"); |
| 51 | } | ||
| 52 | |||
| 53 | void | ||
| 54 | ✗ | throw_length_error( | |
| 55 | char const* what) | ||
| 56 | { | ||
| 57 | ✗ | throw std::length_error(what); | |
| 58 | } | ||
| 59 | |||
| 60 | void | ||
| 61 | ✗ | throw_logic_error() | |
| 62 | { | ||
| 63 | throw std::logic_error( | ||
| 64 | ✗ | "logic error"); | |
| 65 | } | ||
| 66 | |||
| 67 | void | ||
| 68 | ✗ | throw_out_of_range() | |
| 69 | { | ||
| 70 | ✗ | throw std::out_of_range("out of range"); | |
| 71 | } | ||
| 72 | |||
| 73 | void | ||
| 74 | ✗ | throw_runtime_error( | |
| 75 | char const* what) | ||
| 76 | { | ||
| 77 | ✗ | throw std::runtime_error(what); | |
| 78 | } | ||
| 79 | |||
| 80 | void | ||
| 81 | ✗ | throw_system_error( | |
| 82 | std::error_code const& ec) | ||
| 83 | { | ||
| 84 | ✗ | throw std::system_error(ec); | |
| 85 | } | ||
| 86 | |||
| 87 | } // detail | ||
| 88 | } // capy | ||
| 89 | } // boost | ||
| 90 |