@@ -49,22 +49,31 @@ HTTPUpdate::~HTTPUpdate(void)
49
49
HTTPUpdateResult HTTPUpdate::update (WiFiClient& client, const String& url, const String& currentVersion)
50
50
{
51
51
HTTPClient http;
52
- http.begin (client, url);
52
+ if (!http.begin (client, url))
53
+ {
54
+ return HTTP_UPDATE_FAILED;
55
+ }
53
56
return handleUpdate (http, currentVersion, false );
54
57
}
55
58
56
59
HTTPUpdateResult HTTPUpdate::updateSpiffs (WiFiClient& client, const String& url, const String& currentVersion)
57
60
{
58
61
HTTPClient http;
59
- http.begin (client, url);
62
+ if (!http.begin (client, url))
63
+ {
64
+ return HTTP_UPDATE_FAILED;
65
+ }
60
66
return handleUpdate (http, currentVersion, true );
61
67
}
62
68
63
69
HTTPUpdateResult HTTPUpdate::update (WiFiClient& client, const String& host, uint16_t port, const String& uri,
64
70
const String& currentVersion)
65
71
{
66
72
HTTPClient http;
67
- http.begin (client, host, port, uri);
73
+ if (!http.begin (client, host, port, uri))
74
+ {
75
+ return HTTP_UPDATE_FAILED;
76
+ }
68
77
return handleUpdate (http, currentVersion, false );
69
78
}
70
79
0 commit comments