USRP Hardware Driver and USRP Manual: exception.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2011 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#pragma once
9
10#include <uhd/config.hpp>
11#include <boost/preprocessor/stringize.hpp>
12#include <stdexcept>
13#include <string>
14
32namespace uhd {
33
36 struct UHD_API exception : std::runtime_error
37{
38 exception(const std::string& what);
39 virtual unsigned code(void) const = 0;
40 virtual exception* dynamic_clone(void) const = 0;
41 virtual void dynamic_throw(void) const = 0;
42};
43
48 struct UHD_API assertion_error : exception
49{
50 assertion_error(const std::string& what);
51 unsigned code(void) const override;
52 assertion_error* dynamic_clone(void) const override;
53 void dynamic_throw(void) const override;
54};
55
59 struct UHD_API lookup_error : exception
60{
61 lookup_error(const std::string& what);
62 unsigned code(void) const override;
63 lookup_error* dynamic_clone(void) const override;
64 void dynamic_throw(void) const override;
65};
66
69 struct UHD_API index_error : lookup_error
70{
71 index_error(const std::string& what);
72 unsigned code(void) const override;
73 index_error* dynamic_clone(void) const override;
74 void dynamic_throw(void) const override;
75};
76
82 struct UHD_API key_error : lookup_error
83{
84 key_error(const std::string& what);
85 unsigned code(void) const override;
86 key_error* dynamic_clone(void) const override;
87 void dynamic_throw(void) const override;
88};
89
96 struct UHD_API type_error : exception
97{
98 type_error(const std::string& what);
99 unsigned code(void) const override;
100 type_error* dynamic_clone(void) const override;
101 void dynamic_throw(void) const override;
102};
103
108 struct UHD_API value_error : exception
109{
110 value_error(const std::string& what);
111 unsigned code(void) const override;
112 value_error* dynamic_clone(void) const override;
113 void dynamic_throw(void) const override;
114};
115
121 struct UHD_API narrowing_error : value_error
122{
123 narrowing_error(const std::string& what);
124 unsigned code(void) const override;
125 narrowing_error* dynamic_clone(void) const override;
126 void dynamic_throw(void) const override;
127};
128
132 struct UHD_API runtime_error : exception
133{
134 runtime_error(const std::string& what);
135 unsigned code(void) const override;
136 runtime_error* dynamic_clone(void) const override;
137 void dynamic_throw(void) const override;
138};
139
142 struct UHD_API usb_error : runtime_error
143{
144 int _code;
145 usb_error(int code, const std::string& what);
146 unsigned code(void) const override
147 {
148 return _code;
149 };
150 usb_error* dynamic_clone(void) const override;
151 void dynamic_throw(void) const override;
152};
153
157 struct UHD_API not_implemented_error : runtime_error
158{
159 not_implemented_error(const std::string& what);
160 unsigned code(void) const override;
161 not_implemented_error* dynamic_clone(void) const override;
162 void dynamic_throw(void) const override;
163};
164
168 struct UHD_API access_error : runtime_error
169{
170 access_error(const std::string& what);
171 unsigned code(void) const override;
172 access_error* dynamic_clone(void) const override;
173 void dynamic_throw(void) const override;
174};
175
178 struct UHD_API environment_error : exception
179{
180 environment_error(const std::string& what);
181 unsigned code(void) const override;
182 environment_error* dynamic_clone(void) const override;
183 void dynamic_throw(void) const override;
184};
185
188 struct UHD_API io_error : environment_error
189{
190 io_error(const std::string& what);
191 unsigned code(void) const override;
192 io_error* dynamic_clone(void) const override;
193 void dynamic_throw(void) const override;
194};
195
198 struct UHD_API os_error : environment_error
199{
200 os_error(const std::string& what);
201 unsigned code(void) const override;
202 os_error* dynamic_clone(void) const override;
203 void dynamic_throw(void) const override;
204};
205
208 struct UHD_API system_error : exception
209{
210 system_error(const std::string& what);
211 unsigned code(void) const override;
212 system_error* dynamic_clone(void) const override;
213 void dynamic_throw(void) const override;
214};
215
220 struct UHD_API syntax_error : exception
221{
222 syntax_error(const std::string& what);
223 unsigned code(void) const override;
224 syntax_error* dynamic_clone(void) const override;
225 void dynamic_throw(void) const override;
226};
227
230 struct UHD_API rfnoc_error : exception
231{
232 rfnoc_error(const std::string& what);
233 unsigned code(void) const override;
234 rfnoc_error* dynamic_clone(void) const override;
235 void dynamic_throw(void) const override;
236};
237
240 struct UHD_API op_failed : rfnoc_error
241{
242 op_failed(const std::string& what);
243 unsigned code(void) const override;
244 op_failed* dynamic_clone(void) const override;
245 void dynamic_throw(void) const override;
246};
247
251 struct UHD_API op_timeout : rfnoc_error
252{
253 op_timeout(const std::string& what);
254 unsigned code(void) const override;
255 op_timeout* dynamic_clone(void) const override;
256 void dynamic_throw(void) const override;
257};
258
261 struct UHD_API op_seqerr : rfnoc_error
262{
263 op_seqerr(const std::string& what);
264 unsigned code(void) const override;
265 op_seqerr* dynamic_clone(void) const override;
266 void dynamic_throw(void) const override;
267};
268
271 struct UHD_API op_timerr : rfnoc_error
272{
273 op_timerr(const std::string& what);
274 unsigned code(void) const override;
275 op_timerr* dynamic_clone(void) const override;
276 void dynamic_throw(void) const override;
277};
278
281 struct UHD_API resolve_error : rfnoc_error
282{
283 resolve_error(const std::string& what);
284 unsigned code(void) const override;
285 resolve_error* dynamic_clone(void) const override;
286 void dynamic_throw(void) const override;
287};
288
291 struct UHD_API routing_error : rfnoc_error
292{
293 routing_error(const std::string& what);
294 unsigned code(void) const override;
295 routing_error* dynamic_clone(void) const override;
296 void dynamic_throw(void) const override;
297};
298
305#define UHD_THROW_SITE_INFO(what) \
306 std::string(std::string(what) + "\n" + " in " + std::string(UHD_FUNCTION) + "\n" \
307 + " at " + std::string(__FILE__) + ":" \
308 + BOOST_PP_STRINGIZE(__LINE__) + "\n")
309
314#define UHD_THROW_INVALID_CODE_PATH() \
315 throw uhd::system_error(UHD_THROW_SITE_INFO("invalid code path"))
316
322#define UHD_ASSERT_THROW(code) \
323 { \
324 if (not(code)) \
325 throw uhd::assertion_error(UHD_THROW_SITE_INFO(#code)); \
326 }
327
328} // namespace uhd
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd
Definition build_info.hpp:12
uhd::access_error::dynamic_throw
void dynamic_throw(void) const override
uhd::access_error::dynamic_clone
access_error * dynamic_clone(void) const override
uhd::access_error::code
unsigned code(void) const override
uhd::access_error::access_error
access_error(const std::string &what)
uhd::assertion_error::dynamic_clone
assertion_error * dynamic_clone(void) const override
uhd::assertion_error::assertion_error
assertion_error(const std::string &what)
uhd::assertion_error::code
unsigned code(void) const override
uhd::assertion_error::dynamic_throw
void dynamic_throw(void) const override
uhd::environment_error::environment_error
environment_error(const std::string &what)
uhd::environment_error::dynamic_clone
environment_error * dynamic_clone(void) const override
uhd::environment_error::dynamic_throw
void dynamic_throw(void) const override
uhd::environment_error::code
unsigned code(void) const override
uhd::exception::exception
exception(const std::string &what)
uhd::exception::dynamic_throw
virtual void dynamic_throw(void) const =0
uhd::exception::dynamic_clone
virtual exception * dynamic_clone(void) const =0
uhd::exception::code
virtual unsigned code(void) const =0
uhd::index_error::dynamic_throw
void dynamic_throw(void) const override
uhd::index_error::index_error
index_error(const std::string &what)
uhd::index_error::code
unsigned code(void) const override
uhd::index_error::dynamic_clone
index_error * dynamic_clone(void) const override
uhd::io_error::io_error
io_error(const std::string &what)
uhd::io_error::dynamic_clone
io_error * dynamic_clone(void) const override
uhd::io_error::dynamic_throw
void dynamic_throw(void) const override
uhd::io_error::code
unsigned code(void) const override
uhd::key_error::key_error
key_error(const std::string &what)
uhd::key_error::dynamic_throw
void dynamic_throw(void) const override
uhd::key_error::code
unsigned code(void) const override
uhd::key_error::dynamic_clone
key_error * dynamic_clone(void) const override
uhd::lookup_error::dynamic_clone
lookup_error * dynamic_clone(void) const override
uhd::lookup_error::code
unsigned code(void) const override
uhd::lookup_error::dynamic_throw
void dynamic_throw(void) const override
uhd::lookup_error::lookup_error
lookup_error(const std::string &what)
uhd::narrowing_error::dynamic_clone
narrowing_error * dynamic_clone(void) const override
uhd::narrowing_error::dynamic_throw
void dynamic_throw(void) const override
uhd::narrowing_error::narrowing_error
narrowing_error(const std::string &what)
uhd::narrowing_error::code
unsigned code(void) const override
uhd::not_implemented_error::not_implemented_error
not_implemented_error(const std::string &what)
uhd::not_implemented_error::code
unsigned code(void) const override
uhd::not_implemented_error::dynamic_clone
not_implemented_error * dynamic_clone(void) const override
uhd::not_implemented_error::dynamic_throw
void dynamic_throw(void) const override
uhd::op_failed::dynamic_clone
op_failed * dynamic_clone(void) const override
uhd::op_failed::code
unsigned code(void) const override
uhd::op_failed::op_failed
op_failed(const std::string &what)
uhd::op_failed::dynamic_throw
void dynamic_throw(void) const override
uhd::op_seqerr::dynamic_throw
void dynamic_throw(void) const override
uhd::op_seqerr::dynamic_clone
op_seqerr * dynamic_clone(void) const override
uhd::op_seqerr::op_seqerr
op_seqerr(const std::string &what)
uhd::op_seqerr::code
unsigned code(void) const override
uhd::op_timeout::dynamic_clone
op_timeout * dynamic_clone(void) const override
uhd::op_timeout::op_timeout
op_timeout(const std::string &what)
uhd::op_timeout::code
unsigned code(void) const override
uhd::op_timeout::dynamic_throw
void dynamic_throw(void) const override
uhd::op_timerr::dynamic_clone
op_timerr * dynamic_clone(void) const override
uhd::op_timerr::op_timerr
op_timerr(const std::string &what)
uhd::op_timerr::dynamic_throw
void dynamic_throw(void) const override
uhd::op_timerr::code
unsigned code(void) const override
uhd::os_error::dynamic_clone
os_error * dynamic_clone(void) const override
uhd::os_error::dynamic_throw
void dynamic_throw(void) const override
uhd::os_error::code
unsigned code(void) const override
uhd::os_error::os_error
os_error(const std::string &what)
uhd::resolve_error::dynamic_throw
void dynamic_throw(void) const override
uhd::resolve_error::code
unsigned code(void) const override
uhd::resolve_error::dynamic_clone
resolve_error * dynamic_clone(void) const override
uhd::resolve_error::resolve_error
resolve_error(const std::string &what)
uhd::rfnoc_error::dynamic_clone
rfnoc_error * dynamic_clone(void) const override
uhd::rfnoc_error::rfnoc_error
rfnoc_error(const std::string &what)
uhd::rfnoc_error::code
unsigned code(void) const override
uhd::rfnoc_error::dynamic_throw
void dynamic_throw(void) const override
uhd::routing_error::routing_error
routing_error(const std::string &what)
uhd::routing_error::dynamic_clone
routing_error * dynamic_clone(void) const override
uhd::routing_error::dynamic_throw
void dynamic_throw(void) const override
uhd::routing_error::code
unsigned code(void) const override
uhd::runtime_error::runtime_error
runtime_error(const std::string &what)
uhd::runtime_error::code
unsigned code(void) const override
uhd::runtime_error::dynamic_throw
void dynamic_throw(void) const override
uhd::runtime_error::dynamic_clone
runtime_error * dynamic_clone(void) const override
uhd::syntax_error::code
unsigned code(void) const override
uhd::syntax_error::dynamic_throw
void dynamic_throw(void) const override
uhd::syntax_error::dynamic_clone
syntax_error * dynamic_clone(void) const override
uhd::syntax_error::syntax_error
syntax_error(const std::string &what)
uhd::system_error::system_error
system_error(const std::string &what)
uhd::system_error::code
unsigned code(void) const override
uhd::system_error::dynamic_throw
void dynamic_throw(void) const override
uhd::system_error::dynamic_clone
system_error * dynamic_clone(void) const override
uhd::type_error::dynamic_throw
void dynamic_throw(void) const override
uhd::type_error::type_error
type_error(const std::string &what)
uhd::type_error::code
unsigned code(void) const override
uhd::type_error::dynamic_clone
type_error * dynamic_clone(void) const override
uhd::usb_error::code
unsigned code(void) const override
Definition exception.hpp:146
uhd::usb_error::dynamic_clone
usb_error * dynamic_clone(void) const override
uhd::usb_error::_code
int _code
Definition exception.hpp:144
uhd::usb_error::usb_error
usb_error(int code, const std::string &what)
uhd::usb_error::dynamic_throw
void dynamic_throw(void) const override
uhd::value_error::value_error
value_error(const std::string &what)
uhd::value_error::dynamic_clone
value_error * dynamic_clone(void) const override
uhd::value_error::code
unsigned code(void) const override
uhd::value_error::dynamic_throw
void dynamic_throw(void) const override