18 #ifndef INCLUDED_UHD_ERROR_H 19 #define INCLUDED_UHD_ERROR_H 84 #include <boost/exception/diagnostic_information.hpp> 90 UHD_API const std::string& get_c_global_error_string();
92 UHD_API void set_c_global_error_string(
const std::string &msg);
99 #define UHD_SAFE_C(...) \ 101 catch (const uhd::exception &e) { \ 102 set_c_global_error_string(e.what()); \ 103 return error_from_uhd_exception(&e); \ 105 catch (const boost::exception &e) { \ 106 set_c_global_error_string(boost::diagnostic_information(e)); \ 107 return UHD_ERROR_BOOSTEXCEPT; \ 109 catch (const std::exception &e) { \ 110 set_c_global_error_string(e.what()); \ 111 return UHD_ERROR_STDEXCEPT; \ 114 set_c_global_error_string("Unrecognized exception caught."); \ 115 return UHD_ERROR_UNKNOWN; \ 117 set_c_global_error_string("None"); \ 118 return UHD_ERROR_NONE; 125 #define UHD_SAFE_C_SAVE_ERROR(h, ...) \ 126 h->last_error.clear(); \ 128 catch (const uhd::exception &e) { \ 129 set_c_global_error_string(e.what()); \ 130 h->last_error = e.what(); \ 131 return error_from_uhd_exception(&e); \ 133 catch (const boost::exception &e) { \ 134 set_c_global_error_string(boost::diagnostic_information(e)); \ 135 h->last_error = boost::diagnostic_information(e); \ 136 return UHD_ERROR_BOOSTEXCEPT; \ 138 catch (const std::exception &e) { \ 139 set_c_global_error_string(e.what()); \ 140 h->last_error = e.what(); \ 141 return UHD_ERROR_STDEXCEPT; \ 144 set_c_global_error_string("Unrecognized exception caught."); \ 145 h->last_error = "Unrecognized exception caught."; \ 146 return UHD_ERROR_UNKNOWN; \ 148 h->last_error = "None"; \ 149 set_c_global_error_string("None"); \ 150 return UHD_ERROR_NONE; Definition: exception.hpp:45
See uhd::runtime_error.
Definition: error.h:62
See uhd::io_error.
Definition: error.h:49
See uhd::system_error.
Definition: error.h:66
UHD_API uhd_error uhd_get_last_error(char *error_out, size_t strbuffer_len)
Return the last error string reported by UHD.
See uhd::not_implemented_error.
Definition: error.h:44
See uhd::exception.
Definition: error.h:68
See uhd::os_error.
Definition: error.h:51
See uhd::assertion_error.
Definition: error.h:54
Invalid device arguments.
Definition: error.h:36
See uhd::environment_error.
Definition: error.h:64
See uhd::key_error.
Definition: error.h:41
uhd_error
UHD error codes.
Definition: error.h:31
See uhd::usb_error.
Definition: error.h:46
See uhd::type_error.
Definition: error.h:58
See uhd::index_error.
Definition: error.h:39
No error thrown.
Definition: error.h:34
#define UHD_API
Definition: config.h:73
See uhd::value_error.
Definition: error.h:60
See uhd::lookup_error.
Definition: error.h:56
An unknown error was thrown.
Definition: error.h:77
A boost::exception was thrown.
Definition: error.h:71
A std::exception was thrown.
Definition: error.h:74