diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2019-12-17 15:30:18 -0800 |
---|---|---|
committer | Alexander Larsson <alexander.larsson@gmail.com> | 2019-12-19 09:53:22 +0100 |
commit | dd5a82727cfeb4d53d6ff7489a1ac983d157199c (patch) | |
tree | 4170ee66ea7247f52377abdda3850aab3c43f399 | |
parent | 142a7fd85582dcbf2bb35f33ab3f3469bccdb863 (diff) | |
download | flatpak-dd5a82727cfeb4d53d6ff7489a1ac983d157199c.tar.gz |
app: Improve "remote not found" error message
It often happens that people use --user or --system or --installation
and get a "Remote not found" error message, because they don't
understand that remotes have to be defined separately in each
installation. Make the error message more helpful by pointing out when
one of those options was used.
Fixes https://github.com/flatpak/flatpak/issues/3296
-rw-r--r-- | app/flatpak-builtins-utils.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c index 7fb1265f..07ca765f 100644 --- a/app/flatpak-builtins-utils.c +++ b/app/flatpak-builtins-utils.c @@ -357,8 +357,19 @@ flatpak_resolve_duplicate_remotes (GPtrArray *dirs, if (out_dir) { if (dirs_with_remote->len == 0) - return flatpak_fail_error (error, FLATPAK_ERROR_REMOTE_NOT_FOUND, - "Remote \"%s\" not found", remote_name); + { + if (dirs->len > 1 || dirs->len == 0) + return flatpak_fail_error (error, FLATPAK_ERROR_REMOTE_NOT_FOUND, + _("Remote \"%s\" not found\nHint: Use flatpak remote-add to add a remote"), + remote_name); + else + { + FlatpakDir *dir = g_ptr_array_index (dirs, 0); + return flatpak_fail_error (error, FLATPAK_ERROR_REMOTE_NOT_FOUND, + _("Remote \"%s\" not found in the %s installation"), + remote_name, flatpak_dir_get_name_cached (dir)); + } + } else *out_dir = g_object_ref (g_ptr_array_index (dirs_with_remote, chosen - 1)); } |