MCPcopy Create free account
hub / github.com/1technophile/OpenMQTTGateway / getLastErrorString

Method getLastErrorString

main/zzHTTPUpdate.cpp:94–134  ·  view source on GitHub ↗

* return error code as String * @return String error */

Source from the content-addressed store, hash-verified

92 * @return String error
93 */
94String HTTPUpdate::getLastErrorString(void) {
95 if (_lastError == 0) {
96 return String(); // no error
97 }
98
99 // error from Update class
100 if (_lastError > 0) {
101 StreamString error;
102 Update.printError(error);
103 error.trim(); // remove line ending
104 return String("Update error: ") + error;
105 }
106
107 // error from http client
108 if (_lastError > -100) {
109 return String("HTTP error: ") + HTTPClient::errorToString(_lastError);
110 }
111
112 switch (_lastError) {
113 case HTTP_UE_TOO_LESS_SPACE:
114 return "Not Enough space";
115 case HTTP_UE_SERVER_NOT_REPORT_SIZE:
116 return "Server Did Not Report Size";
117 case HTTP_UE_SERVER_FILE_NOT_FOUND:
118 return "File Not Found (404)";
119 case HTTP_UE_SERVER_FORBIDDEN:
120 return "Forbidden (403)";
121 case HTTP_UE_SERVER_WRONG_HTTP_CODE:
122 return "Wrong HTTP Code";
123 case HTTP_UE_SERVER_FAULTY_MD5:
124 return "Wrong MD5";
125 case HTTP_UE_BIN_VERIFY_HEADER_FAILED:
126 return "Verify Bin Header Failed";
127 case HTTP_UE_BIN_FOR_WRONG_FLASH:
128 return "New Binary Does Not Fit Flash Size";
129 case HTTP_UE_NO_PARTITION:
130 return "Partition Could Not be Found";
131 }
132
133 return String();
134}
135
136String getSketchSHA256() {
137 const size_t HASH_LEN = 32; // SHA-256 digest length

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected