1// Copyright 2014 The Chromium OS Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include <brillo/dbus/dbus_method_invoker.h> 6 7namespace brillo { 8namespace dbus_utils { 9 10void TranslateErrorResponse(const AsyncErrorCallback& callback, 11 dbus::ErrorResponse* resp) { 12 if (!callback.is_null()) { 13 ErrorPtr error; 14 dbus::MessageReader reader(resp); 15 std::string error_message; 16 if (ExtractMessageParameters(&reader, &error, &error_message)) 17 AddDBusError(&error, resp->GetErrorName(), error_message); 18 callback.Run(error.get()); 19 } 20} 21 22} // namespace dbus_utils 23} // namespace brillo 24