From d5d6cfadef7a072f7c4b843509917f1a16b110cf Mon Sep 17 00:00:00 2001
From: Alex Vakulenko <avakulenko@google.com>
Date: Thu, 7 Jan 2016 10:44:18 -0800
Subject: [PATCH] ledflasher: Use helper Command::AbortWithCustomError() method

weaved now provides new variants of Command::Abort() that allow
to specify the error information as brillo::Error or binder::Status.

BUG: 25875613
Change-Id: Icf82c1c6c752eae7e651213d46e42baa103bef38
---
 src/ledflasher/ledflasher.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/ledflasher/ledflasher.cpp b/src/ledflasher/ledflasher.cpp
index 7a991b1..f39dbf2 100644
--- a/src/ledflasher/ledflasher.cpp
+++ b/src/ledflasher/ledflasher.cpp
@@ -156,8 +156,7 @@ void Daemon::OnSet(std::unique_ptr<weaved::Command> command) {
   bool on = command->GetParameter<bool>("on");
   android::binder::Status status = led_service_->setLED(index - 1, on);
   if (!status.isOk()) {
-    command->Abort("_system_error", status.exceptionMessage().string(),
-                   nullptr);
+    command->AbortWithCustomError(status, nullptr);
     return;
   }
   animation_.reset();
@@ -183,8 +182,7 @@ void Daemon::OnToggle(std::unique_ptr<weaved::Command> command) {
   if (status.isOk())
     status = led_service_->setLED(index, !on);
   if(!status.isOk()) {
-    command->Abort("_system_error", status.exceptionMessage().string(),
-                   nullptr);
+    command->AbortWithCustomError(status, nullptr);
     return;
   }
   animation_.reset();
-- 
GitLab