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
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 @@
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 @@
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();