[next] telepathy-glib: TpDBusPropertiesMixin: don't use TP_ERROR
Simon McVittie
smcv at kemper.freedesktop.org
Wed May 7 02:18:24 PDT 2014
Module: telepathy-glib
Branch: next
Commit: 5af6b0f66e3921a1b6941161370e665c79945fab
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=5af6b0f66e3921a1b6941161370e665c79945fab
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed Apr 16 15:07:38 2014 +0100
TpDBusPropertiesMixin: don't use TP_ERROR
We can't do that if we want to put it in the -dbus library. Using
InvalidArgs is consistent with GDBus.
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189
---
telepathy-glib/dbus-properties-mixin.c | 18 +++++++++---------
tests/dbus/account.c | 3 ++-
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/telepathy-glib/dbus-properties-mixin.c b/telepathy-glib/dbus-properties-mixin.c
index 6909424..3723b47 100644
--- a/telepathy-glib/dbus-properties-mixin.c
+++ b/telepathy-glib/dbus-properties-mixin.c
@@ -672,7 +672,7 @@ _iface_impl_get_property_impl (
if (prop_impl == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Unknown property %s on %s", property_name, interface_name);
return FALSE;
}
@@ -681,14 +681,14 @@ _iface_impl_get_property_impl (
if ((prop_info->flags & TP_DBUS_PROPERTIES_MIXIN_FLAG_READ) == 0)
{
- g_set_error (error, TP_ERROR, TP_ERROR_PERMISSION_DENIED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Property %s on %s is write-only", property_name, interface_name);
return FALSE;
}
if (iface_impl->getter == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Getting properties on %s is unimplemented", interface_name);
return FALSE;
}
@@ -735,7 +735,7 @@ tp_dbus_properties_mixin_get (GObject *self,
if (iface_impl == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"No properties known for interface %s", interface_name);
return FALSE;
}
@@ -1149,7 +1149,7 @@ tp_dbus_properties_mixin_set (
if (iface_impl == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"No properties known for interface '%s'", interface_name);
return FALSE;
}
@@ -1161,7 +1161,7 @@ tp_dbus_properties_mixin_set (
if (prop_impl == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Unknown property '%s' on interface '%s'", property_name,
interface_name);
return FALSE;
@@ -1171,14 +1171,14 @@ tp_dbus_properties_mixin_set (
if ((prop_info->flags & TP_DBUS_PROPERTIES_MIXIN_FLAG_WRITE) == 0)
{
- g_set_error (error, TP_ERROR, TP_ERROR_PERMISSION_DENIED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"'%s.%s' is read-only", interface_name, property_name);
return FALSE;
}
if (iface_impl->setter == NULL)
{
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Setting properties on '%s' is unimplemented", interface_name);
return FALSE;
}
@@ -1189,7 +1189,7 @@ tp_dbus_properties_mixin_set (
if (!g_value_transform (value, ©))
{
- g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
"Cannot convert %s to %s for property %s",
g_type_name (G_VALUE_TYPE (value)),
g_type_name (prop_info->type),
diff --git a/tests/dbus/account.c b/tests/dbus/account.c
index fc1b4da..036d485 100644
--- a/tests/dbus/account.c
+++ b/tests/dbus/account.c
@@ -263,7 +263,8 @@ test_setters (Test *test,
&test->result);
tp_tests_run_until_result (&test->result);
tp_account_set_enabled_finish (test->account, test->result, &test->error);
- g_assert_error (test->error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED);
+ /* this is what TpDBusPropertiesMixin raises for an unimplemented property */
+ g_assert_error (test->error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS);
g_clear_error (&test->error);
tp_clear_object (&test->result);
}
More information about the telepathy-commits
mailing list