Line data 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 <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 0 : throw_bad_alloc(
30 : source_location const& loc)
31 : {
32 0 : throw_exception(
33 0 : std::bad_alloc(), loc);
34 : }
35 :
36 : void
37 0 : throw_invalid_argument(
38 : source_location const& loc)
39 : {
40 0 : throw_exception(
41 0 : 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 8 : std::invalid_argument(what), loc);
53 : }
54 :
55 : void
56 0 : throw_length_error(
57 : source_location const& loc)
58 : {
59 0 : throw_exception(
60 0 : std::length_error(
61 : "length error"), loc);
62 : }
63 :
64 : void
65 0 : throw_length_error(
66 : char const* what,
67 : source_location const& loc)
68 : {
69 0 : throw_exception(
70 0 : std::length_error(what), loc);
71 : }
72 :
73 : void
74 0 : throw_logic_error(
75 : source_location const& loc)
76 : {
77 0 : throw_exception(
78 0 : std::logic_error(
79 : "logic error"),
80 : loc);
81 : }
82 :
83 : void
84 0 : throw_out_of_range(
85 : source_location const& loc)
86 : {
87 0 : throw_exception(
88 0 : std::out_of_range("out of range"), loc);
89 : }
90 :
91 : void
92 0 : throw_runtime_error(
93 : char const* what,
94 : source_location const& loc)
95 : {
96 0 : throw_exception(
97 0 : 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 14 : system::system_error(ec), loc);
107 : }
108 :
109 : } // detail
110 : } // capy
111 : } // boost
|