From 850459e0793e3bb1d3ca6a1c51735fa195ccc4f8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 15 Sep 2014 15:55:39 +0100 Subject: invoke_object_method: when demarshalling fails, use the right error This replaces the inappropriate org.freedesktop.DBus.GLib.ErrorError with the intended error codes, affecting two tests. Signed-off-by: Simon McVittie Resolves: https://gitlab.freedesktop.org/dbus/dbus-glib/issues/1 --- dbus/dbus-gobject.c | 2 +- test/core/test-variant-recursion.c | 3 +-- test/core/unsupported-type.c | 6 ------ 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index 977c012..8d06723 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -1788,7 +1788,7 @@ invoke_object_method (GObject *object, { g_free (in_signature); g_array_free (types_array, TRUE); - reply = error_or_die (message, "org.freedesktop.DBus.GLib.ErrorError", error->message); + reply = gerror_to_dbus_error_message (object_info, message, error); connection_send_or_die (connection, reply); dbus_message_unref (reply); g_error_free (error); diff --git a/test/core/test-variant-recursion.c b/test/core/test-variant-recursion.c index 507ea4d..8278d9f 100644 --- a/test/core/test-variant-recursion.c +++ b/test/core/test-variant-recursion.c @@ -92,8 +92,7 @@ main (int argc, char **argv) /* More than the current internal limit (16) */ if (make_recursive_stringify_call (50, proxy, &error)) g_error ("Unexpected success code from 50 recursive variant call: %s", error->message); - if (error->code != DBUS_GERROR_REMOTE_EXCEPTION) - g_error ("Error code was not remote exception: %s", error->message); + g_assert_error (error, DBUS_GERROR, DBUS_GERROR_NO_MEMORY); g_printerr ("Got expected error %d: \"%s\" from recursive variant call\n", error->code, error->message); g_clear_error (&error); diff --git a/test/core/unsupported-type.c b/test/core/unsupported-type.c index f8dca7c..d8e397b 100644 --- a/test/core/unsupported-type.c +++ b/test/core/unsupported-type.c @@ -197,15 +197,9 @@ test_call (Fixture *f, dbus_pending_call_unref (pc); /* it didn't work */ -#if 0 /* this is what it should be */ g_assert_cmpstr (dbus_message_get_error_name (reply), ==, DBUS_ERROR_INVALID_SIGNATURE); -#else - /* this is what it is right now */ - g_assert_cmpstr (dbus_message_get_error_name (reply), ==, - "org.freedesktop.DBus.GLib.ErrorError"); -#endif /* it didn't call the into the user-supplied C code */ g_assert_cmpuint (MY_OBJECT (f->object)->echo_variant_called, ==, 0); -- cgit v1.2.1