core: provide useful error messages to main() on Manager creation failure

This commit is contained in:
Dan Williams 2014-01-24 12:58:25 -06:00
parent e62b212be3
commit 016dbcc99e
2 changed files with 5 additions and 2 deletions

View file

@ -4505,7 +4505,8 @@ nm_manager_new (NMSettings *settings,
bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
if (!bus) {
nm_log_err (LOGD_CORE, "Failed to initialize D-Bus connection");
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_INTERNAL,
"Failed to initialize D-Bus connection");
g_object_unref (singleton);
return NULL;
}
@ -4528,7 +4529,8 @@ nm_manager_new (NMSettings *settings,
G_CALLBACK (connectivity_changed), singleton);
if (!dbus_connection_add_filter (dbus_connection, prop_filter, singleton, NULL)) {
nm_log_err (LOGD_CORE, "failed to register DBus connection filter");
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_INTERNAL,
"Failed to register DBus connection filter");
g_object_unref (singleton);
return NULL;
}

View file

@ -49,6 +49,7 @@ typedef enum {
NM_MANAGER_ERROR_DEPENDENCY_FAILED, /*< nick=DependencyFailed >*/
NM_MANAGER_ERROR_AUTOCONNECT_NOT_ALLOWED, /*< nick=AutoconnectNotAllowed >*/
NM_MANAGER_ERROR_CONNECTION_ALREADY_ACTIVE, /*< nick=ConnectionAlreadyActive >*/
NM_MANAGER_ERROR_INTERNAL, /*< nick=Internal >*/
} NMManagerError;
#define NM_MANAGER_VERSION "version"