Loading...
Searching...
No Matches
exception.hpp
Go to the documentation of this file.
//
// Copyright 2010-2011 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <stdexcept>
#include <string>
namespace uhd {
struct UHD_API exception : std::runtime_error
{
exception(const std::string& what);
virtual unsigned code(void) const = 0;
virtual exception* dynamic_clone(void) const = 0;
virtual void dynamic_throw(void) const = 0;
};
struct UHD_API assertion_error : exception
{
assertion_error(const std::string& what);
unsigned code(void) const override;
assertion_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API lookup_error : exception
{
lookup_error(const std::string& what);
unsigned code(void) const override;
lookup_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API index_error : lookup_error
{
index_error(const std::string& what);
unsigned code(void) const override;
index_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API key_error : lookup_error
{
key_error(const std::string& what);
unsigned code(void) const override;
key_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API type_error : exception
{
type_error(const std::string& what);
unsigned code(void) const override;
type_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API value_error : exception
{
value_error(const std::string& what);
unsigned code(void) const override;
value_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API narrowing_error : value_error
{
narrowing_error(const std::string& what);
unsigned code(void) const override;
narrowing_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API runtime_error : exception
{
runtime_error(const std::string& what);
unsigned code(void) const override;
runtime_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API usb_error : runtime_error
{
int _code;
usb_error(int code, const std::string& what);
unsigned code(void) const override
{
return _code;
};
usb_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API not_implemented_error : runtime_error
{
not_implemented_error(const std::string& what);
unsigned code(void) const override;
not_implemented_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API access_error : runtime_error
{
access_error(const std::string& what);
unsigned code(void) const override;
access_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API environment_error : exception
{
environment_error(const std::string& what);
unsigned code(void) const override;
environment_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API io_error : environment_error
{
io_error(const std::string& what);
unsigned code(void) const override;
io_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API os_error : environment_error
{
os_error(const std::string& what);
unsigned code(void) const override;
os_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API system_error : exception
{
system_error(const std::string& what);
unsigned code(void) const override;
system_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API syntax_error : exception
{
syntax_error(const std::string& what);
unsigned code(void) const override;
syntax_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API rfnoc_error : exception
{
rfnoc_error(const std::string& what);
unsigned code(void) const override;
rfnoc_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API op_failed : rfnoc_error
{
op_failed(const std::string& what);
unsigned code(void) const override;
op_failed* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API op_timeout : rfnoc_error
{
op_timeout(const std::string& what);
unsigned code(void) const override;
op_timeout* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API op_seqerr : rfnoc_error
{
op_seqerr(const std::string& what);
unsigned code(void) const override;
op_seqerr* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API op_timerr : rfnoc_error
{
op_timerr(const std::string& what);
unsigned code(void) const override;
op_timerr* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API resolve_error : rfnoc_error
{
resolve_error(const std::string& what);
unsigned code(void) const override;
resolve_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
struct UHD_API routing_error : rfnoc_error
{
routing_error(const std::string& what);
unsigned code(void) const override;
routing_error* dynamic_clone(void) const override;
void dynamic_throw(void) const override;
};
#define UHD_THROW_SITE_INFO(what) \
std::string(std::string(what) + "\n" + " in " + std::string(UHD_FUNCTION) + "\n" \
+ " at " + std::string(__FILE__) + ":" + std::to_string(__LINE__) \
+ "\n")
#define UHD_THROW_INVALID_CODE_PATH() \
throw uhd::system_error(UHD_THROW_SITE_INFO("invalid code path"))
#define UHD_ASSERT_THROW(code) \
{ \
if (not(code)) \
throw uhd::assertion_error(UHD_THROW_SITE_INFO(#code)); \
}
} // 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:145
uhd::usb_error::dynamic_clone
usb_error * dynamic_clone(void) const override
uhd::usb_error::_code
int _code
Definition exception.hpp:143
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