summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 06:12:11 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 06:12:11 +0000
commit6b0f973847635757eded91e2009320dda89561c0 (patch)
tree31fc263ec432e318a141f27af7789b5cb7089058 /dbus
parent8ec7fcd15b6668dc67b556906b0bcfa24026de2c (diff)
downloadchromium_src-6b0f973847635757eded91e2009320dda89561c0.zip
chromium_src-6b0f973847635757eded91e2009320dda89561c0.tar.gz
chromium_src-6b0f973847635757eded91e2009320dda89561c0.tar.bz2
dbus: Include method names in error messages for method call failures
To make it easier to investigate method call failures. BUG=126217 TEST=run EndToEndAsyncTest.Timeout and confirm the error message is changed ("org.chromium.TestInterface.SlowEcho" is now included): BEFORE [ RUN ] EndToEndAsyncTest.Timeout [24410:24410:0530/105557:701377078661:ERROR:object_proxy.cc(456)] Failed to call method: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. AFTER [ RUN ] EndToEndAsyncTest.Timeout [24959:24959:0530/110437:701896995336:ERROR:object_proxy.cc(462)] Failed to call method: org.chromium.TestInterface.SlowEcho: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. Review URL: https://chromiumcodereview.appspot.com/10456030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus')
-rw-r--r--dbus/object_proxy.cc22
-rw-r--r--dbus/object_proxy.h8
2 files changed, 23 insertions, 7 deletions
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 4d7aa25..ea5f330 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -82,7 +82,9 @@ Response* ObjectProxy::CallMethodAndBlock(MethodCall* method_call,
kSuccessRatioHistogramMaxValue);
if (!response_message) {
- LogMethodCallFailure(error.is_set() ? error.name() : "unknown error type",
+ LogMethodCallFailure(method_call->GetInterface(),
+ method_call->GetMember(),
+ error.is_set() ? error.name() : "unknown error type",
error.is_set() ? error.message() : "");
return NULL;
}
@@ -99,6 +101,8 @@ void ObjectProxy::CallMethod(MethodCall* method_call,
CallMethodWithErrorCallback(method_call, timeout_ms, callback,
base::Bind(&ObjectProxy::OnCallMethodError,
this,
+ method_call->GetInterface(),
+ method_call->GetMember(),
callback));
}
@@ -449,22 +453,30 @@ DBusHandlerResult ObjectProxy::HandleMessageThunk(
}
void ObjectProxy::LogMethodCallFailure(
+ const base::StringPiece& interface_name,
+ const base::StringPiece& method_name,
const base::StringPiece& error_name,
const base::StringPiece& error_message) const {
if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown)
return;
- LOG(ERROR) << "Failed to call method: " << error_name
- << ": " << error_message;
+ LOG(ERROR) << "Failed to call method: "
+ << interface_name << "." << method_name
+ << ": " << error_name << ": " << error_message;
}
-void ObjectProxy::OnCallMethodError(ResponseCallback response_callback,
+void ObjectProxy::OnCallMethodError(const std::string& interface_name,
+ const std::string& method_name,
+ ResponseCallback response_callback,
ErrorResponse* error_response) {
if (error_response) {
// Error message may contain the error message as string.
dbus::MessageReader reader(error_response);
std::string error_message;
reader.PopString(&error_message);
- LogMethodCallFailure(error_response->GetErrorName(), error_message);
+ LogMethodCallFailure(interface_name,
+ method_name,
+ error_response->GetErrorName(),
+ error_message);
}
response_callback.Run(NULL);
}
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index 620622f..0311854 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -226,11 +226,15 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
void* user_data);
// Helper method for logging response errors appropriately.
- void LogMethodCallFailure(const base::StringPiece& error_name,
+ void LogMethodCallFailure(const base::StringPiece& interface_name,
+ const base::StringPiece& method_name,
+ const base::StringPiece& error_name,
const base::StringPiece& error_message) const;
// Used as ErrorCallback by CallMethod().
- void OnCallMethodError(ResponseCallback response_callback,
+ void OnCallMethodError(const std::string& interface_name,
+ const std::string& method_name,
+ ResponseCallback response_callback,
ErrorResponse* error_response);
scoped_refptr<Bus> bus_;