-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_type.cpp
More file actions
35 lines (30 loc) · 936 Bytes
/
error_type.cpp
File metadata and controls
35 lines (30 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "error_type.h"
static libesp::IErrorDetail *app = 0;
static const char *LibEspErrors [(libesp::ErrorType::TOTAL_LIBESP_ERRORS-libesp::ErrorType::LIB_BASE)] {
"NO_BOUNDING_VOLUME"
, "TIMEOUT_ERROR"
, "DEVICE_CRC_ERROR"
, "INVALID_CONFIG"
, "INVALID_PARAM"
, "MAX_RETRIES"
, "INCOMPLETE_HTTP_GET"
, "OTA_PREVIOUSLY_ROLLED_BACK"
, "OTA_NO_NEW_VERSION"
};
void libesp::ErrorType::setAppDetail(libesp::IErrorDetail *id) {
app = id;
}
libesp::IErrorDetail *libesp::ErrorType::getAppDetail() {
return app;
}
const char *libesp::ErrorType::toString() {
if(ErrType<APP_BASE && ErrType<LIB_BASE) {
return ::esp_err_to_name(ErrType);
} else if(ErrType>=LIB_BASE) {
return LibEspErrors[ErrType-LIB_BASE];
} else if(getAppDetail()) {
return getAppDetail()->toString(ErrType-APP_BASE);
}
return (const char *)"";
}
//const char *libesp::ErrorType::toString() { return ::esp_err_to_name(ErrType); }