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