MCPcopy Create free account
hub / github.com/ARMmbed/DAPLink / error_get_string

Function error_get_string

source/daplink/error.c:237–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235COMPILER_ASSERT(ERROR_COUNT == ARRAY_SIZE(error_type));
236
237const char *error_get_string(error_t error)
238{
239#if !DAPLINK_NO_ERROR_MESSAGES
240 const char *msg = NULL;
241
242 if (error < ERROR_COUNT) {
243 msg = error_message[error];
244 }
245
246 if (0 == msg) {
247 util_assert(0);
248 msg = "";
249 }
250
251 return msg;
252#else // DAPLINK_NO_ERROR_MESSAGES
253 static char error_num_str[10] = "Error 00";
254#define ERROR_NUM_CHAR_INDEX (6) // offset of first '0' in error_num_str[]
255
256 error_num_str[ERROR_NUM_CHAR_INDEX+0] = '0' + ((int)error / 1000) % 10;
257 error_num_str[ERROR_NUM_CHAR_INDEX+1] = '0' + ((int)error / 100) % 10;
258 COMPILER_ASSERT(ERROR_COUNT < 100); // if this assert is hit, add a digit here
259 error_num_str[ERROR_NUM_CHAR_INDEX+2] = 0;
260#endif // DAPLINK_NO_ERROR_MESSAGES
261}
262
263error_type_t error_get_type(error_t error)
264{

Callers 2

read_file_fail_txtFunction · 0.85
transfer_update_stateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected