Properly report an error for download action write errors

DownloadAction only terminates the processing pipeline if
DeltaPerformer::Write() return false AND an error code is set. If false
is returned but no error code set, download action stops downloading
more data w/o telling the caller that the update has stopped. To caller
will simply sit their and wait indefinitely for a status update.

Test: th
Bug: 284352074
Change-Id: I20516f7bccf5ea348990100ed557d050fbf8b670
diff --git a/common/multi_range_http_fetcher.cc b/common/multi_range_http_fetcher.cc
index 6ce3dae..b5bf923 100644
--- a/common/multi_range_http_fetcher.cc
+++ b/common/multi_range_http_fetcher.cc
@@ -21,8 +21,6 @@
 #include <algorithm>
 #include <string>
 
-#include "update_engine/common/utils.h"
-
 namespace chromeos_update_engine {
 
 // Begins the transfer to the specified URL.
diff --git a/download_action.cc b/download_action.cc
index c0463de..615eb66 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -226,6 +226,10 @@
       LOG(ERROR) << "Error " << utils::ErrorCodeToString(code_) << " (" << code_
                  << ") in DeltaPerformer's Write method when "
                  << "processing the received payload -- Terminating processing";
+    } else {
+      LOG(ERROR) << "Unknown error in DeltaPerformer's Write method when "
+                 << "processing the received payload -- Terminating processing";
+      code_ = ErrorCode::kDownloadWriteError;
     }
     // Don't tell the action processor that the action is complete until we get
     // the TransferTerminated callback. Otherwise, this and the HTTP fetcher
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 3bd131d..a9670cd 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -753,12 +753,17 @@
     auto generator = partition_update_generator::Create(boot_control_,
                                                         manifest_.block_size());
     std::vector<PartitionUpdate> untouched_static_partitions;
-    TEST_AND_RETURN_FALSE(
-        generator->GenerateOperationsForPartitionsNotInPayload(
+    if (!generator->GenerateOperationsForPartitionsNotInPayload(
             install_plan_->source_slot,
             install_plan_->target_slot,
             touched_partitions,
-            &untouched_static_partitions));
+            &untouched_static_partitions)) {
+      LOG(ERROR)
+          << "Failed to generate operations for partitions not in payload "
+          << android::base::Join(touched_partitions, ", ");
+      *error = ErrorCode::kDownloadStateInitializationError;
+      return false;
+    }
     partitions_.insert(partitions_.end(),
                        untouched_static_partitions.begin(),
                        untouched_static_partitions.end());
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index abfae72..5342e6f 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -96,10 +96,10 @@
   install_plan_ = GetInputObject();
 
   if (install_plan_.partitions.empty()) {
-    LOG(INFO) << "No partitions to verify.";
+    LOG(ERROR) << "No partitions to verify.";
     if (HasOutputPipe())
       SetOutputObject(install_plan_);
-    abort_action_completer.set_code(ErrorCode::kSuccess);
+    abort_action_completer.set_code(ErrorCode::kFilesystemVerifierError);
     return;
   }
   // partition_weight_[i] = total size of partitions before index i.