From f8dbd199da1a7c4b3f67775ef854a00dd3cf109c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 20 Jun 2012 11:07:40 +0200 Subject: [PATCH] debug-client: propagate error if GetMessages() failed https://bugs.freedesktop.org/show_bug.cgi?id=51250 --- telepathy-glib/debug-client.c | 1 + tests/dbus/debug-client.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c index ef6ed29..113ac3f 100644 --- a/telepathy-glib/debug-client.c +++ b/telepathy-glib/debug-client.c @@ -475,6 +475,7 @@ get_messages_cb (TpDebugClient *self, if (error != NULL) { DEBUG ("GetMessages() failed: %s", error->message); + g_simple_async_result_set_from_error (result, error); goto out; } diff --git a/tests/dbus/debug-client.c b/tests/dbus/debug-client.c index 5ae3219..50d07fa 100644 --- a/tests/dbus/debug-client.c +++ b/tests/dbus/debug-client.c @@ -294,6 +294,22 @@ test_new_debug_message (Test *test, "new message"); } +static void +test_get_messages_failed (Test *test, + gconstpointer data G_GNUC_UNUSED) +{ + /* Remove debug service */ + tp_clear_object (&test->sender); + + tp_debug_client_get_messages_async (test->client, get_messages_cb, test); + + test->wait = 1; + g_main_loop_run (test->mainloop); + g_assert_error (test->error, DBUS_GERROR, DBUS_GERROR_UNKNOWN_METHOD); + + g_assert (test->messages == NULL); +} + int main (int argc, char **argv) @@ -313,6 +329,8 @@ main (int argc, test_get_messages, teardown); g_test_add ("/debug-client/new-debug-message", Test, NULL, setup, test_new_debug_message, teardown); + g_test_add ("/debug-client/get-messages-failed", Test, NULL, setup, + test_get_messages_failed, teardown); return g_test_run (); } -- 1.7.10.2