summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm.h12
-rw-r--r--lib/libalpm/error.c25
-rw-r--r--lib/libalpm/package.c8
-rw-r--r--lib/libalpm/util.c2
-rw-r--r--src/util/testpkg.c2
6 files changed, 22 insertions, 29 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 619ce5e6..0bbec44c 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -695,7 +695,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
if ((archive = archive_read_new()) == NULL) {
- RET_ERR(PM_ERR_LIBARCHIVE_ERROR, -1);
+ RET_ERR(PM_ERR_LIBARCHIVE, -1);
}
archive_read_support_compression_all(archive);
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 25eb88c5..bd641b3b 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -433,12 +433,6 @@ enum _pmerrno_t {
PM_ERR_DB_REMOVE,
/* Servers */
PM_ERR_SERVER_BAD_URL,
- /* Configuration */
- PM_ERR_OPT_LOGFILE,
- PM_ERR_OPT_DBPATH,
- PM_ERR_OPT_LOCALDB,
- PM_ERR_OPT_SYNCDB,
- PM_ERR_OPT_USESYSLOG,
/* Transactions */
PM_ERR_TRANS_NOT_NULL,
PM_ERR_TRANS_NULL,
@@ -470,14 +464,16 @@ enum _pmerrno_t {
/* Misc */
PM_ERR_USER_ABORT,
PM_ERR_INTERNAL_ERROR,
- PM_ERR_LIBARCHIVE_ERROR,
PM_ERR_DB_SYNC,
PM_ERR_RETRIEVE,
PM_ERR_PKG_HOLD,
PM_ERR_INVALID_REGEX,
/* Downloading */
PM_ERR_CONNECT_FAILED,
- PM_ERR_FORK_FAILED
+ PM_ERR_FORK_FAILED,
+ /* External library errors */
+ PM_ERR_LIBARCHIVE,
+ PM_ERR_LIBDOWNLOAD
};
extern enum _pmerrno_t pm_errno;
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 66b4e288..7fa07b70 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,13 @@
#include "config.h"
+#include <download.h> /* downloadLastErrString */
+
/* 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 +72,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");
@@ -137,8 +128,6 @@ 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");
@@ -147,6 +136,14 @@ const char SYMEXPORT *alpm_strerror(int err)
/* 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:
+ return downloadLastErrString;
/* Unknown error! */
default:
return _("unexpected error");
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 587e7fc4..b072f3f3 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -509,7 +509,7 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
int ret = ARCHIVE_OK;
if((archive = archive_read_new()) == NULL) {
- RET_ERR(PM_ERR_LIBARCHIVE_ERROR, NULL);
+ RET_ERR(PM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
@@ -995,7 +995,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full)
}
if((archive = archive_read_new()) == NULL) {
- RET_ERR(PM_ERR_LIBARCHIVE_ERROR, NULL);
+ RET_ERR(PM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
@@ -1052,7 +1052,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full)
if(archive_read_data_skip(archive)) {
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
pkgfile, archive_error_string(archive));
- pm_errno = PM_ERR_LIBARCHIVE_ERROR;
+ pm_errno = PM_ERR_LIBARCHIVE;
goto error;
}
@@ -1065,7 +1065,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full)
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
_alpm_log(PM_LOG_ERROR, _("error while reading package %s: %s\n"),
pkgfile, archive_error_string(archive));
- pm_errno = PM_ERR_LIBARCHIVE_ERROR;
+ pm_errno = PM_ERR_LIBARCHIVE;
goto error;
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 7de5b069..1e94190a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -382,7 +382,7 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
ALPM_LOG_FUNC;
if((_archive = archive_read_new()) == NULL)
- RET_ERR(PM_ERR_LIBARCHIVE_ERROR, -1);
+ RET_ERR(PM_ERR_LIBARCHIVE, -1);
archive_read_support_compression_all(_archive);
archive_read_support_format_all(_archive);
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 64056ce4..6e8f9d1c 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
case PM_ERR_PKG_OPEN:
printf("Cannot open the given file.\n");
break;
- case PM_ERR_LIBARCHIVE_ERROR:
+ case PM_ERR_LIBARCHIVE:
case PM_ERR_PKG_INVALID:
printf("Package is invalid.\n");
break;