2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* error.c
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2011-01-05 23:45:15 -05:00
|
|
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
2009-07-01 03:08:33 -04:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2005-03-14 20:51:43 -05:00
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-12-10 23:55:22 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-14 20:51:43 -05:00
|
|
|
*/
|
|
|
|
|
2007-03-05 17:13:33 -05:00
|
|
|
#include "config.h"
|
|
|
|
|
2010-12-15 19:57:31 -05:00
|
|
|
#ifdef HAVE_LIBCURL
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#endif
|
|
|
|
|
2007-03-05 17:13:33 -05:00
|
|
|
/* libalpm */
|
2006-05-14 22:19:57 -04:00
|
|
|
#include "util.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "alpm.h"
|
2011-01-15 15:38:16 -05:00
|
|
|
#include "handle.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2011-10-28 22:03:24 -04:00
|
|
|
alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
|
2007-09-08 12:41:45 -04:00
|
|
|
{
|
2011-06-07 17:06:16 -04:00
|
|
|
return handle->pm_errno;
|
2007-09-08 12:41:45 -04:00
|
|
|
}
|
|
|
|
|
2011-10-28 22:03:24 -04:00
|
|
|
const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
|
2005-03-14 20:51:43 -05:00
|
|
|
{
|
|
|
|
switch(err) {
|
|
|
|
/* System */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_MEMORY:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("out of memory!");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_SYSTEM:
|
2006-11-16 12:24:41 -05:00
|
|
|
return _("unexpected system error");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_BADPERMS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("insufficient privileges");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_NOT_A_FILE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find or read file");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_NOT_A_DIR:
|
2007-08-21 21:28:05 -04:00
|
|
|
return _("could not find or read directory");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_WRONG_ARGS:
|
2007-02-09 05:10:49 -05:00
|
|
|
return _("wrong or NULL argument passed");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DISK_SPACE:
|
2011-01-11 19:52:30 -05:00
|
|
|
return _("not enough free disk space");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Interface */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_HANDLE_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("library not initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_HANDLE_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("library already initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_HANDLE_LOCK:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("unable to lock database");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Databases */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_OPEN:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not open database");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_CREATE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not create database");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("database not initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("database already registered");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_NOT_FOUND:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find database");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_INVALID:
|
2011-06-07 21:42:15 -04:00
|
|
|
return _("invalid or corrupted database");
|
2011-06-27 17:29:49 -04:00
|
|
|
case ALPM_ERR_DB_INVALID_SIG:
|
|
|
|
return _("invalid or corrupted database (PGP signature)");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_VERSION:
|
2011-02-28 11:46:00 -05:00
|
|
|
return _("database is incorrect version");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_WRITE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not update database");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DB_REMOVE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not remove database entry");
|
2007-02-09 05:10:49 -05:00
|
|
|
/* Servers */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_SERVER_BAD_URL:
|
2007-02-09 05:10:49 -05:00
|
|
|
return _("invalid url for server");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_SERVER_NONE:
|
2009-06-06 12:03:29 -04:00
|
|
|
return _("no servers configured for repository");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Transactions */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction already initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_NULL:
|
2007-02-09 05:10:49 -05:00
|
|
|
return _("transaction not initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_DUP_TARGET:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("duplicate target");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_NOT_INITIALIZED:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction not initialized");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_NOT_PREPARED:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction not prepared");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_ABORT:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction aborted");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_TYPE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("operation not compatible with the transaction type");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_TRANS_NOT_LOCKED:
|
2009-05-16 10:54:21 -04:00
|
|
|
return _("transaction commit attempt when database is not locked");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Packages */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_NOT_FOUND:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find or read package");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_IGNORED:
|
2008-11-09 11:34:49 -05:00
|
|
|
return _("operation cancelled due to ignorepkg");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_INVALID:
|
2011-08-08 20:42:52 -04:00
|
|
|
return _("invalid or corrupted package");
|
|
|
|
case ALPM_ERR_PKG_INVALID_CHECKSUM:
|
2011-06-27 17:29:49 -04:00
|
|
|
return _("invalid or corrupted package (checksum)");
|
|
|
|
case ALPM_ERR_PKG_INVALID_SIG:
|
|
|
|
return _("invalid or corrupted package (PGP signature)");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_OPEN:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("cannot open package file");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_CANT_REMOVE:
|
2007-02-08 03:09:34 -05:00
|
|
|
return _("cannot remove all files for package");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_INVALID_NAME:
|
2008-04-26 14:03:53 -04:00
|
|
|
return _("package filename is not valid");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
2009-08-19 11:58:03 -04:00
|
|
|
return _("package architecture is not valid");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_PKG_REPO_NOT_FOUND:
|
2009-09-15 10:07:25 -04:00
|
|
|
return _("could not find repository for target");
|
2008-12-07 14:20:25 -05:00
|
|
|
/* Signatures */
|
2011-06-27 17:29:49 -04:00
|
|
|
case ALPM_ERR_SIG_MISSING:
|
|
|
|
return _("missing PGP signature");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_SIG_INVALID:
|
2008-12-07 14:20:25 -05:00
|
|
|
return _("invalid PGP signature");
|
2007-10-19 13:17:53 -04:00
|
|
|
/* Deltas */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DLT_INVALID:
|
2008-02-26 18:50:17 -05:00
|
|
|
return _("invalid or corrupted delta");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_DLT_PATCHFAILED:
|
2007-10-19 13:17:53 -04:00
|
|
|
return _("delta patch failed");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Dependencies */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not satisfy dependencies");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_CONFLICTING_DEPS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("conflicting dependencies");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_FILE_CONFLICTS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("conflicting files");
|
2005-10-08 19:40:49 -04:00
|
|
|
/* Miscellaenous */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_RETRIEVE:
|
2009-04-18 11:35:08 -04:00
|
|
|
return _("failed to retrieve some files");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_INVALID_REGEX:
|
2007-01-18 11:52:57 -05:00
|
|
|
return _("invalid regular expression");
|
2008-04-06 21:09:27 -04:00
|
|
|
/* Errors from external libraries- our own wrapper error */
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_LIBARCHIVE:
|
2008-04-06 21:09:27 -04:00
|
|
|
/* 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");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_LIBCURL:
|
2011-01-15 15:38:16 -05:00
|
|
|
return _("download library error");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_GPGME:
|
2008-12-07 12:58:24 -05:00
|
|
|
return _("gpgme error");
|
2011-07-01 12:01:39 -04:00
|
|
|
case ALPM_ERR_EXTERNAL_DOWNLOAD:
|
2008-04-06 22:00:11 -04:00
|
|
|
return _("error invoking external downloader");
|
2007-02-09 05:10:49 -05:00
|
|
|
/* Unknown error! */
|
2005-03-14 20:51:43 -05:00
|
|
|
default:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("unexpected error");
|
2005-03-14 20:51:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set ts=2 sw=2 noet: */
|