Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: download_action.cc

Issue 3046007: Add and emit download action error codes. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « action_processor.h ('k') | download_action_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_action.cc
diff --git a/download_action.cc b/download_action.cc
index 9be81f0eb763a69c694d7ca0210729b2ea7d52b8..5ecb99e435e66f23fef780fe2660fb64121c58d7 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -61,7 +61,7 @@ void DownloadAction::PerformAction() {
if (rc < 0) {
LOG(ERROR) << "Unable to open output file " << install_plan_.install_path;
// report error to processor
- processor_->ActionComplete(this, kActionCodeError);
+ processor_->ActionComplete(this, kActionCodeInstallDeviceOpenError);
return;
}
if (!install_plan_.is_full_update) {
@@ -70,7 +70,7 @@ void DownloadAction::PerformAction() {
LOG(ERROR) << "Unable to open kernel file "
<< install_plan_.kernel_install_path.c_str();
writer_->Close();
- processor_->ActionComplete(this, kActionCodeError);
+ processor_->ActionComplete(this, kActionCodeKernelDeviceOpenError);
return;
}
}
@@ -116,25 +116,25 @@ void DownloadAction::TransferComplete(HttpFetcher *fetcher, bool successful) {
CHECK_EQ(writer_->Close(), 0) << errno;
writer_ = NULL;
}
- if (successful) {
+ ActionExitCode code =
+ successful ? kActionCodeSuccess : kActionCodeDownloadTransferError;
+ if (code == kActionCodeSuccess) {
// Make sure hash is correct
omaha_hash_calculator_.Finalize();
if (omaha_hash_calculator_.hash() != install_plan_.download_hash) {
LOG(ERROR) << "Download of " << install_plan_.download_url
<< " failed. Expect hash " << install_plan_.download_hash
<< " but got hash " << omaha_hash_calculator_.hash();
- successful = false;
+ code = kActionCodeDownloadHashMismatchError;
}
}
FlushLinuxCaches();
- // Write the path to the output pipe if we're successful
- if (successful && HasOutputPipe())
+ // Write the path to the output pipe if we're successful.
+ if (code == kActionCodeSuccess && HasOutputPipe())
SetOutputObject(GetInputObject());
- processor_->ActionComplete(
- this,
- successful ? kActionCodeSuccess : kActionCodeError);
+ processor_->ActionComplete(this, code);
}
}; // namespace {}
« no previous file with comments | « action_processor.h ('k') | download_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698