1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 17:22:20 +01:00

[online_image] Improve error handling (#8212)

This commit is contained in:
guillempages
2025-02-11 12:12:13 +01:00
committed by GitHub
parent 8b7aa4c110
commit c9e7562aff
7 changed files with 35 additions and 13 deletions

View File

@@ -178,7 +178,12 @@ void OnlineImage::update() {
this->download_error_callback_.call();
return;
}
this->decoder_->prepare(total_size);
auto prepare_result = this->decoder_->prepare(total_size);
if (prepare_result < 0) {
this->end_connection_();
this->download_error_callback_.call();
return;
}
ESP_LOGI(TAG, "Downloading image (Size: %d)", total_size);
this->start_time_ = ::time(nullptr);
}