From 282b9df60d8dcfaea14e927721ff99968bc22721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 26 Sep 2013 15:06:17 +0200 Subject: [PATCH] vpn: fix VPN plugin D-Bus errors The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*, but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.* Also update the errors documentation. --- include/NetworkManagerVPN.h | 1 + introspection/vpn-errors.xml | 40 ++++++++++++++++++++++------- libnm-glib/nm-vpn-plugin.c | 2 +- src/vpn-manager/nm-vpn-connection.c | 2 +- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/include/NetworkManagerVPN.h b/include/NetworkManagerVPN.h index c5e6d3a456..5997c99f9d 100644 --- a/include/NetworkManagerVPN.h +++ b/include/NetworkManagerVPN.h @@ -41,6 +41,7 @@ #define NM_DBUS_NO_VPN_CONNECTIONS "org.freedesktop.NetworkManager.VPNConnections.NoVPNConnections" #define NM_DBUS_INVALID_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.InvalidVPNConnection" +#define NM_DBUS_VPN_ERROR_PREFIX "org.freedesktop.NetworkManager.VPN.Error" #define NM_DBUS_VPN_STARTING_IN_PROGRESS "StartingInProgress" #define NM_DBUS_VPN_ALREADY_STARTED "AlreadyStarted" #define NM_DBUS_VPN_STOPPING_IN_PROGRESS "StoppingInProgress" diff --git a/introspection/vpn-errors.xml b/introspection/vpn-errors.xml index c5bf73d972..7b92d07366 100644 --- a/introspection/vpn-errors.xml +++ b/introspection/vpn-errors.xml @@ -2,31 +2,53 @@ - This is a drab, nondescript error. + General failure without further details. - The request could not be processed because the VPN connection is already being started. + + The plugin is already starting, and another connect request was received. + - The request could not be processed because a VPN connection was already active. + + The plugin is already connected, and another connect request was received. + - The request could not be processed because the VPN connection is already being stopped. + + The plugin is already stopping, and another stop request was received. + - The request could not be processed because the VPN connection was already stopped. + + The plugin is already stopped, and another disconnect request was received. + - The request could not be processed because the VPN connection is in the wrong state for this type of request. FIXME: too general? + + The request could not be processed because the VPN plugin is in the wrong + state for this type of request. + - Invalid arguments were passed with the request. FIXME: too general. + + The request could not be processed because it contained malformed + arguments, or arguments of unexpected type. It usually means that one of + the VPN setting data items or secrets was not of the expected type (i.e. + int, string, bool, etc). + - A binary providing the service failed to launch. + + A binary providing the service failed to launch. + - The request could not be processed because the VPN connection settings were invalid. + + The request could not be processed because the connection was invalid. It + usually means that the connection's VPN setting was missing some required + data item or secret. + diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index 4289267f95..d5a2b69c76 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -1053,7 +1053,7 @@ nm_vpn_plugin_class_init (NMVPNPluginClass *plugin_class) G_TYPE_NONE); dbus_g_error_domain_register (NM_VPN_PLUGIN_ERROR, - NULL, + NM_DBUS_VPN_ERROR_PREFIX, NM_TYPE_VPN_PLUGIN_ERROR); setup_unix_signal_handler (); diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index a42613a8b8..66b95fde5f 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -1181,7 +1181,7 @@ connect_interactive_cb (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data return; } - if (dbus_g_error_has_name (err, "org.freedesktop.NetworkManager.VPN.Plugin.InteractiveNotSupported")) { + if (dbus_g_error_has_name (err, NM_DBUS_VPN_ERROR_PREFIX "." NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED)) { /* Fall back to Connect() */ dbus_g_proxy_begin_call (priv->proxy, "Connect", connect_cb, self, NULL,