diff options
author | Colin Walters <walters@verbum.org> | 2005-06-26 17:02:09 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2005-06-26 17:02:09 +0000 |
commit | df901b528bc1e1edd96e9e91b94c9c9b795b8ffd (patch) | |
tree | f455e436a057d8525edb4d29067674eb781331da /test/glib | |
parent | c904e1e3a695f8f15f098d9316ead6f0db637780 (diff) |
2005-06-26 Colin Walters <walters@verbum.org>
* glib/dbus-glib.c (dbus_set_g_error): Delete.
(dbus_g_error_set): New public function from its ashes; used by
both service-side method implementation and GLib bindings
internals.
(dbus_g_error_has_name, dbus_g_error_get_name): New function.
(_dbus_glib_test): Add some tests.
* test/glib/test-dbus-glib.c (main): Test dbus_g_error_has_name.
* test/glib/test-service-glib.c (my_object_throw_error): Use
dbus_g_error_set.
* glib/dbus-gobject.c (gerror_to_dbus_error_message): Handle
errors thrown by dbus_g_error_set.
* glib/dbus-gmain.c (dbus_g_bus_get): Change to dbus_g_error_set.
* glib/dbus-gparser.c (validate_signature): Ditto.
* glib/dbus-gproxy.c (dbus_g_proxy_new_for_name_owner)
(dbus_g_proxy_end_call_internal): Ditto.
* glib/Makefile.am: Generate dbus-glib-error-switch.h, which
converts DBUS_ERROR_x to DBUS_GERROR_x.
(libdbus_glib_1_la_SOURCES, BUILT_SOURCES, CLEANFILES): Add it.
* doc/TODO: Remove error TODO.
* doc/dbus-tutorial.xml: Update with documentation about error
handling.
* dbus/make-dbus-glib-error-enum.sh: Tighten up regexp to make
sure we only change DBUS_ERROR to DBUS_GERROR, not all ERROR to
GERROR. Also add DBUS_GERROR_REMOTE_EXCEPTION.
Diffstat (limited to 'test/glib')
-rw-r--r-- | test/glib/test-dbus-glib.c | 2 | ||||
-rw-r--r-- | test/glib/test-service-glib.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c index ba979cb6..94aeaeb3 100644 --- a/test/glib/test-dbus-glib.c +++ b/test/glib/test-dbus-glib.c @@ -318,6 +318,8 @@ main (int argc, char **argv) error = NULL; if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID) != FALSE) lose ("ThrowError call unexpectedly succeeded!"); + if (!dbus_g_error_has_name (error, "org.freedesktop.DBus.Tests.MyObject.Foo")) + lose ("ThrowError call returned unexpected error %s", dbus_g_error_get_name (error)); g_print ("ThrowError failed (as expected) returned error: %s\n", error->message); g_clear_error (&error); diff --git a/test/glib/test-service-glib.c b/test/glib/test-service-glib.c index 6089367e..21c4458d 100644 --- a/test/glib/test-service-glib.c +++ b/test/glib/test-service-glib.c @@ -237,10 +237,9 @@ my_object_increment (MyObject *obj, gint32 x, gint32 *ret, GError **error) gboolean my_object_throw_error (MyObject *obj, GError **error) { - g_set_error (error, - MY_OBJECT_ERROR, - MY_OBJECT_ERROR_FOO, - "this method always loses"); + dbus_g_error_set (error, + "org.freedesktop.DBus.Tests.MyObject.Foo", + "this method always loses"); return FALSE; } |