diff options
author | Dan McGee <dan@archlinux.org> | 2011-08-25 18:29:00 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-28 19:52:41 -0500 |
commit | 2cfcc874b9332ad207398b9e20dc8880d93e8ae4 (patch) | |
tree | 6276468d8aa91c6e8546704a5c92166752c01ac6 /src/pacman | |
parent | dc3336c27728fc16d2f9e68cb818648e7ca88467 (diff) |
Better error handling out of package load method
There are many other ways to fail a package load other than "file not
found". We should also use the correct error code in this case. Clean it
up a bit in the various callers.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman')
-rw-r--r-- | src/pacman/query.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c index 2fb985a3..ec98c999 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -332,7 +332,7 @@ static int query_group(alpm_list_t *targets) } } } else { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("group \"%s\" was not found\n"), grpname); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("group '%s' was not found\n"), grpname); ret++; } } @@ -560,7 +560,17 @@ int pacman_query(alpm_list_t *targets) } if(pkg == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("package \"%s\" not found\n"), strname); + switch(alpm_errno(config->handle)) { + case ALPM_ERR_PKG_NOT_FOUND: + pm_fprintf(stderr, ALPM_LOG_ERROR, + _("package '%s' was not found\n"), strname); + break; + default: + pm_fprintf(stderr, ALPM_LOG_ERROR, + _("could not load package '%s': %s\n"), strname, + alpm_strerror(alpm_errno(config->handle))); + break; + } ret = 1; continue; } |