34#define FDS_ERROR_CHECK(ret_code_t) \
36 const uint32_t LOCAL_ret_code_t = (ret_code_t); \
37 if (LOCAL_ret_code_t != NRF_SUCCESS) { \
38 CLOGe("ret_code_t: $nordicFDSTypeName(%u) (0x%X)", LOCAL_ret_code_t, LOCAL_ret_code_t); \
46#ifdef APP_ERROR_HANDLER
47#undef APP_ERROR_HANDLER
49#define APP_ERROR_HANDLER(cs_ret_code_t) \
51 app_error_handler((cs_ret_code_t), __LINE__, (uint8_t*)__FILE__); \
61#define APP_ERROR_CHECK(cs_ret_code_t) \
63 const uint32_t LOCAL_cs_ret_code_t = (cs_ret_code_t); \
64 if (LOCAL_cs_ret_code_t != NRF_SUCCESS) { \
65 CLOGe("cs_ret_code_t: $nordicTypeName(%u) (0x%X)", LOCAL_cs_ret_code_t, LOCAL_cs_ret_code_t); \
66 APP_ERROR_HANDLER(LOCAL_cs_ret_code_t); \
70#define APP_ERROR_CHECK_EXCEPT(cs_ret_code_t, EXCEPTION) \
71 if (cs_ret_code_t == EXCEPTION) { \
72 CLOGw(STRINGIFY((int)EXCEPTION)); \
75 APP_ERROR_CHECK(cs_ret_code_t); \
81class ble_exception :
public std::exception {
84 ble_exception(
char* message,
char* file =
"<unknown>",
int line = 0) : _message(message) {}
85 virtual ~ble_exception()
throw() {}
87 virtual char const* what()
const throw() {
return _message; }
94#define BLE_CALL(function, args) \
96 uint32_t result = function args; \
97 APP_ERROR_CHECK(result); \
100#define BLE_THROW_IF(result, message) \
102 if (result != NRF_SUCCESS) throw ble_exception(message, __FILE__, __LINE__); \
105#define BLE_THROW(message) throw ble_exception(message, __FILE__, __LINE__)
111#define BLE_CALL(function, args) \
113 uint32_t result = function args; \
114 APP_ERROR_CHECK(result); \
117#define BLE_THROW_IF(result, message) \
119 if (result != NRF_SUCCESS) { \
120 CLOGd("BLE_THROW: %s", message); \
121 ble_error_handler(message, __LINE__, __FILE__); \
125#define BLE_THROW(message) \
127 CLOGd("BLE_THROW: %s", message); \
128 ble_error_handler(message, __LINE__, __FILE__); \
void softdevice_assertion_handler(uint32_t pc, uint16_t line_num, const uint8_t *file_name)
void mesh_assertion_handler(uint32_t pc)
void ble_error_handler(const char *msg, uint32_t line_num, const char *p_file_name)
Author: Crownstone Team Date: 21 Sep., 2013 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-...
void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name)
called by soft device when you pass bad parameters, etc.