diff options
author | Thomas Haller <thaller@redhat.com> | 2018-07-10 11:17:05 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-07-20 08:55:14 +0200 |
commit | 06a360eb36ffc20a6d0567e2b4e54d6fae8bd3e7 (patch) | |
tree | f3e1bfb2796ecb700c8ff0ed810f4551b2099970 | |
parent | 91fdca3ae9fd07552b21043f28ae226d6a3432bd (diff) | |
download | NetworkManager-06a360eb36ffc20a6d0567e2b4e54d6fae8bd3e7.tar.gz |
core: improve error message when activating profile on device
Before:
$ nmcli connection up my-wired ifname eth0
Error: Connection activation failed: Connection 'my-wired' is not available on the device eth0 at this time.
After:
$ nmcli connection up my-wired ifname eth0
Error: Connection activation failed: Connection 'my-wired' is not available on device eth0 because device has no carrier
-rw-r--r-- | src/nm-manager.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index f54d649ca4..4bb2e674c5 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -4087,6 +4087,7 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * NMConnection *existing_connection = NULL; NMActiveConnection *master_ac = NULL; NMAuthSubject *subject; + GError *local = NULL; g_return_val_if_fail (NM_IS_MANAGER (self), FALSE); g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE); @@ -4120,10 +4121,13 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError * } /* Final connection must be available on device */ - if (!nm_device_check_connection_available (device, applied, NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, NULL)) { + if (!nm_device_check_connection_available (device, applied, NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, &local)) { g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_CONNECTION, - "Connection '%s' is not available on the device %s at this time.", - nm_settings_connection_get_id (connection), nm_device_get_iface (device)); + "Connection '%s' is not available on device %s because %s", + nm_settings_connection_get_id (connection), + nm_device_get_iface (device), + local->message); + g_error_free (local); return FALSE; } |