24
24
*/
25
25
26
26
#include " ESP8266httpUpdate.h"
27
+ #include < StreamString.h>
27
28
28
29
extern " C" uint32_t _SPIFFS_start;
29
30
extern " C" uint32_t _SPIFFS_end;
@@ -218,8 +219,12 @@ t_httpUpdate_return ESP8266HTTPUpdate::handleUpdate(HTTPClient * http, const cha
218
219
*/
219
220
bool ESP8266HTTPUpdate::runUpdate (Stream& in, uint32_t size, String md5, int command) {
220
221
222
+ StreamString error;
223
+
221
224
if (!Update.begin (size, command)) {
222
- DEBUG_HTTP_UPDATE (" [httpUpdate] Update.begin failed!\n " );
225
+ Update.printError (error);
226
+ error.trim (); // remove line ending
227
+ DEBUG_HTTP_UPDATE (" [httpUpdate] Update.begin failed! (%s)\n " , error.c_str ());
223
228
return false ;
224
229
}
225
230
@@ -228,12 +233,16 @@ bool ESP8266HTTPUpdate::runUpdate(Stream& in, uint32_t size, String md5, int com
228
233
}
229
234
230
235
if (Update.writeStream (in) != size) {
231
- DEBUG_HTTP_UPDATE (" [httpUpdate] Update.writeStream failed!\n " );
236
+ Update.printError (error);
237
+ error.trim (); // remove line ending
238
+ DEBUG_HTTP_UPDATE (" [httpUpdate] Update.writeStream failed! (%s)\n " , error.c_str ());
232
239
return false ;
233
240
}
234
241
235
242
if (!Update.end ()) {
236
- DEBUG_HTTP_UPDATE (" [httpUpdate] Update.end failed!\n " );
243
+ Update.printError (error);
244
+ error.trim (); // remove line ending
245
+ DEBUG_HTTP_UPDATE (" [httpUpdate] Update.end failed! (%s)\n " , error.c_str ());
237
246
return false ;
238
247
}
239
248
0 commit comments