From 016dbcc99e4c9b7f030bfef7d7ce65af87ebd9f5 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 24 Jan 2014 12:58:25 -0600 Subject: [PATCH] core: provide useful error messages to main() on Manager creation failure --- src/nm-manager.c | 6 ++++-- src/nm-manager.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 1545e72ae0..c487f20e52 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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; } diff --git a/src/nm-manager.h b/src/nm-manager.h index fc2b67e0af..1b0865fe0d 100644 --- a/src/nm-manager.h +++ b/src/nm-manager.h @@ -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"