From e4a4cf7ce544707faa691c8ab1bf298549979b12 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 6 Apr 2008 20:09:27 -0500 Subject: libalpm error cleanup, step 1 Remove unused error codes, begin refactoring some of the others. Signed-off-by: Dan McGee --- lib/libalpm/error.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'lib/libalpm/error.c') 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 - * Copyright (c) 2005 by Aurelien Foret - * Copyright (c) 2005 by Christian Hamar - * Copyright (c) 2006 by Miklos Vajna + * Copyright (c) 2002-2008 by Judd Vinet * * 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 /* 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"); -- cgit v1.2.3-24-g4f1b