diff options
author | Alex Vakulenko <avakulenko@google.com> | 2016-01-07 10:44:18 -0800 |
---|---|---|
committer | Alex Vakulenko <avakulenko@google.com> | 2016-01-08 07:45:22 -0800 |
commit | d5d6cfadef7a072f7c4b843509917f1a16b110cf (patch) | |
tree | e24788499a992e4830a7068a456c22da190596ff | |
parent | cb7cf4ae46b7944c38267aea66e193a17bd4b545 (diff) | |
download | example-ledflasher-d5d6cfadef7a072f7c4b843509917f1a16b110cf.tar.gz |
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
-rw-r--r-- | src/ledflasher/ledflasher.cpp | 6 |
1 files 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(); |