8 #ifndef INCLUDED_UHD_ERROR_H 9 #define INCLUDED_UHD_ERROR_H 74 #include <boost/exception/diagnostic_information.hpp> 81 UHD_API std::string get_c_global_error_string();
83 UHD_API void set_c_global_error_string(
const std::string &msg);
90 #define UHD_SAFE_C(...) \ 92 catch (const uhd::exception &e) { \ 93 set_c_global_error_string(e.what()); \ 94 return error_from_uhd_exception(&e); \ 96 catch (const boost::exception &e) { \ 97 set_c_global_error_string(boost::diagnostic_information(e)); \ 98 return UHD_ERROR_BOOSTEXCEPT; \ 100 catch (const std::exception &e) { \ 101 set_c_global_error_string(e.what()); \ 102 return UHD_ERROR_STDEXCEPT; \ 105 set_c_global_error_string("Unrecognized exception caught."); \ 106 return UHD_ERROR_UNKNOWN; \ 108 set_c_global_error_string("None"); \ 109 return UHD_ERROR_NONE; 116 #define UHD_SAFE_C_SAVE_ERROR(h, ...) \ 117 h->last_error.clear(); \ 119 catch (const uhd::exception &e) { \ 120 set_c_global_error_string(e.what()); \ 121 h->last_error = e.what(); \ 122 return error_from_uhd_exception(&e); \ 124 catch (const boost::exception &e) { \ 125 set_c_global_error_string(boost::diagnostic_information(e)); \ 126 h->last_error = boost::diagnostic_information(e); \ 127 return UHD_ERROR_BOOSTEXCEPT; \ 129 catch (const std::exception &e) { \ 130 set_c_global_error_string(e.what()); \ 131 h->last_error = e.what(); \ 132 return UHD_ERROR_STDEXCEPT; \ 135 set_c_global_error_string("Unrecognized exception caught."); \ 136 h->last_error = "Unrecognized exception caught."; \ 137 return UHD_ERROR_UNKNOWN; \ 139 h->last_error = "None"; \ 140 set_c_global_error_string("None"); \ 141 return UHD_ERROR_NONE; Definition: exception.hpp:37
See uhd::runtime_error.
Definition: error.h:52
See uhd::io_error.
Definition: error.h:39
See uhd::system_error.
Definition: error.h:56
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:34
See uhd::exception.
Definition: error.h:58
See uhd::os_error.
Definition: error.h:41
See uhd::assertion_error.
Definition: error.h:44
Invalid device arguments.
Definition: error.h:26
See uhd::environment_error.
Definition: error.h:54
See uhd::key_error.
Definition: error.h:31
uhd_error
UHD error codes.
Definition: error.h:21
See uhd::usb_error.
Definition: error.h:36
See uhd::type_error.
Definition: error.h:48
See uhd::index_error.
Definition: error.h:29
No error thrown.
Definition: error.h:24
#define UHD_API
Definition: config.h:68
See uhd::value_error.
Definition: error.h:50
See uhd::lookup_error.
Definition: error.h:46
An unknown error was thrown.
Definition: error.h:67
A boost::exception was thrown.
Definition: error.h:61
A std::exception was thrown.
Definition: error.h:64