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