diff options
Diffstat (limited to 'lib/libalpm/error.c')
-rw-r--r-- | lib/libalpm/error.c | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c index a68340ad..7c30cd09 100644 --- a/lib/libalpm/error.c +++ b/lib/libalpm/error.c @@ -1,10 +1,7 @@ /* * error.c * - * Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> - * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> - * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> - * Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org> + * Copyright (c) 2002-2008 by Judd Vinet <jvinet@zeroflux.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,12 +19,28 @@ #include "config.h" +/* TODO: needed for the libfetch stuff, unfortunately- we should kill it */ +#include <stdio.h> +#include <limits.h> +/* the following two are needed on BSD for libfetch */ +#if defined(HAVE_SYS_SYSLIMITS_H) +#include <sys/syslimits.h> /* PATH_MAX */ +#endif +#if defined(HAVE_SYS_PARAM_H) +#include <sys/param.h> /* MAXHOSTNAMELEN */ +#endif + +#if defined(HAVE_LIBDOWNLOAD) +#include <download.h> /* downloadLastErrString */ +#elif defined(HAVE_LIBFETCH) +#include <fetch.h> /* fetchLastErrString */ +#define downloadLastErrString fetchLastErrString +#endif + /* libalpm */ -#include "error.h" #include "util.h" #include "alpm.h" -/* TODO does this really need a file all on its own? */ const char SYMEXPORT *alpm_strerrorlast(void) { return alpm_strerror(pm_errno); @@ -74,13 +87,6 @@ const char SYMEXPORT *alpm_strerror(int err) /* Servers */ case PM_ERR_SERVER_BAD_URL: return _("invalid url for server"); - /* Configuration */ - case PM_ERR_OPT_LOGFILE: - case PM_ERR_OPT_DBPATH: - case PM_ERR_OPT_LOCALDB: - case PM_ERR_OPT_SYNCDB: - case PM_ERR_OPT_USESYSLOG: - return _("could not set parameter"); /* Transactions */ case PM_ERR_TRANS_NOT_NULL: return _("transaction already initialized"); @@ -109,21 +115,17 @@ const char SYMEXPORT *alpm_strerror(int err) return _("cannot open package file"); case PM_ERR_PKG_LOAD: return _("cannot load package data"); - case PM_ERR_PKG_INSTALLED: - return _("package already installed"); case PM_ERR_PKG_CANT_FRESH: return _("package not installed or lesser version"); case PM_ERR_PKG_CANT_REMOVE: return _("cannot remove all files for package"); case PM_ERR_PKG_INVALID_NAME: return _("package name is not valid"); - case PM_ERR_PKG_CORRUPTED: - return _("corrupted package"); case PM_ERR_PKG_REPO_NOT_FOUND: return _("no such repository"); /* Deltas */ - case PM_ERR_DLT_CORRUPTED: - return _("corrupted delta"); + case PM_ERR_DLT_INVALID: + return _("invalid or corrupted delta"); case PM_ERR_DLT_PATCHFAILED: return _("delta patch failed"); /* Groups */ @@ -141,16 +143,26 @@ const char SYMEXPORT *alpm_strerror(int err) return _("user aborted the operation"); case PM_ERR_INTERNAL_ERROR: return _("internal error"); - case PM_ERR_LIBARCHIVE_ERROR: - return _("libarchive error"); case PM_ERR_PKG_HOLD: /* TODO wow this is not descriptive at all... what does this mean? */ return _("not confirmed"); case PM_ERR_INVALID_REGEX: return _("invalid regular expression"); - /* Downloading */ - case PM_ERR_CONNECT_FAILED: - return _("connection to remote host failed"); + /* Errors from external libraries- our own wrapper error */ + case PM_ERR_LIBARCHIVE: + /* it would be nice to use archive_error_string() here, but that + * requires the archive struct, so we can't. Just use a generic + * error string instead. */ + return _("libarchive error"); + case PM_ERR_LIBDOWNLOAD: +#if defined(INTERNAL_DOWNLOAD) + return downloadLastErrString; +#else + /* obviously shouldn't get here... */ + return _("download library error"); +#endif + case PM_ERR_EXTERNAL_DOWNLOAD: + return _("error invoking external downloader"); /* Unknown error! */ default: return _("unexpected error"); |