2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* error.c
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2007-12-10 23:55:22 -05:00
|
|
|
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
2006-10-15 15:31:03 -04:00
|
|
|
* 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>
|
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"
|
|
|
|
|
|
|
|
/* libalpm */
|
|
|
|
#include "error.h"
|
2006-05-14 22:19:57 -04:00
|
|
|
#include "util.h"
|
2005-03-14 20:51:43 -05:00
|
|
|
#include "alpm.h"
|
|
|
|
|
2007-03-05 17:13:33 -05:00
|
|
|
/* TODO does this really need a file all on its own? */
|
2007-09-08 12:41:45 -04:00
|
|
|
const char SYMEXPORT *alpm_strerrorlast(void)
|
|
|
|
{
|
|
|
|
return alpm_strerror(pm_errno);
|
|
|
|
}
|
|
|
|
|
2007-06-05 17:34:33 -04:00
|
|
|
const char SYMEXPORT *alpm_strerror(int err)
|
2005-03-14 20:51:43 -05:00
|
|
|
{
|
|
|
|
switch(err) {
|
|
|
|
/* System */
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_MEMORY:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("out of memory!");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_SYSTEM:
|
2006-11-16 12:24:41 -05:00
|
|
|
return _("unexpected system error");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_BADPERMS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("insufficient privileges");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_NOT_A_FILE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find or read file");
|
2007-08-21 21:28:05 -04:00
|
|
|
case PM_ERR_NOT_A_DIR:
|
|
|
|
return _("could not find or read directory");
|
2007-02-09 05:10:49 -05:00
|
|
|
case PM_ERR_WRONG_ARGS:
|
|
|
|
return _("wrong or NULL argument passed");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Interface */
|
|
|
|
case PM_ERR_HANDLE_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("library not initialized");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_HANDLE_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("library already initialized");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_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 */
|
|
|
|
case PM_ERR_DB_OPEN:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not open database");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_DB_CREATE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not create database");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_DB_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("database not initialized");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_DB_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("database already registered");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_DB_NOT_FOUND:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find database");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_DB_WRITE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not update database");
|
2006-02-07 17:01:50 -05:00
|
|
|
case PM_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 */
|
|
|
|
case PM_ERR_SERVER_BAD_URL:
|
|
|
|
return _("invalid url for server");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Configuration */
|
|
|
|
case PM_ERR_OPT_LOGFILE:
|
|
|
|
case PM_ERR_OPT_DBPATH:
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_OPT_LOCALDB:
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_OPT_SYNCDB:
|
|
|
|
case PM_ERR_OPT_USESYSLOG:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not set parameter");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Transactions */
|
|
|
|
case PM_ERR_TRANS_NOT_NULL:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction already initialized");
|
2007-02-09 05:10:49 -05:00
|
|
|
case PM_ERR_TRANS_NULL:
|
|
|
|
return _("transaction not initialized");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_TRANS_DUP_TARGET:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("duplicate target");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_TRANS_NOT_INITIALIZED:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction not initialized");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_TRANS_NOT_PREPARED:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction not prepared");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_TRANS_ABORT:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("transaction aborted");
|
2006-02-07 17:01:50 -05:00
|
|
|
case PM_ERR_TRANS_TYPE:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("operation not compatible with the transaction type");
|
2007-02-09 05:10:49 -05:00
|
|
|
case PM_ERR_TRANS_COMMITING:
|
|
|
|
return _("could not commit transaction");
|
|
|
|
case PM_ERR_TRANS_DOWNLOADING:
|
|
|
|
return _("could not download all files");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Packages */
|
|
|
|
case PM_ERR_PKG_NOT_FOUND:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not find or read package");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_PKG_INVALID:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("invalid or corrupted package");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_PKG_OPEN:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("cannot open package file");
|
2005-10-08 19:40:49 -04:00
|
|
|
case PM_ERR_PKG_LOAD:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("cannot load package data");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_PKG_INSTALLED:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("package already installed");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_PKG_CANT_FRESH:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("package not installed or lesser version");
|
2007-02-08 03:09:34 -05:00
|
|
|
case PM_ERR_PKG_CANT_REMOVE:
|
|
|
|
return _("cannot remove all files for package");
|
2005-04-17 06:01:22 -04:00
|
|
|
case PM_ERR_PKG_INVALID_NAME:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("package name is not valid");
|
2006-10-31 01:39:59 -05:00
|
|
|
case PM_ERR_PKG_REPO_NOT_FOUND:
|
|
|
|
return _("no such repository");
|
2007-10-19 13:17:53 -04:00
|
|
|
/* Deltas */
|
2008-02-26 18:50:17 -05:00
|
|
|
case PM_ERR_DLT_INVALID:
|
|
|
|
return _("invalid or corrupted delta");
|
2007-10-19 13:17:53 -04:00
|
|
|
case PM_ERR_DLT_PATCHFAILED:
|
|
|
|
return _("delta patch failed");
|
2005-10-08 19:40:49 -04:00
|
|
|
/* Groups */
|
|
|
|
case PM_ERR_GRP_NOT_FOUND:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("group not found");
|
2005-03-14 20:51:43 -05:00
|
|
|
/* Dependencies */
|
|
|
|
case PM_ERR_UNSATISFIED_DEPS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("could not satisfy dependencies");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_CONFLICTING_DEPS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("conflicting dependencies");
|
2005-03-14 20:51:43 -05:00
|
|
|
case PM_ERR_FILE_CONFLICTS:
|
2006-05-14 22:19:57 -04:00
|
|
|
return _("conflicting files");
|
2005-10-08 19:40:49 -04:00
|
|
|
/* Miscellaenous */
|
|
|
|
case PM_ERR_USER_ABORT:
|
2007-02-09 05:10:49 -05:00
|
|
|
return _("user aborted the operation");
|
2006-10-15 15:31:03 -04:00
|
|
|
case PM_ERR_INTERNAL_ERROR:
|
|
|
|
return _("internal error");
|
2007-02-09 05:10:49 -05:00
|
|
|
case PM_ERR_LIBARCHIVE_ERROR:
|
|
|
|
return _("libarchive error");
|
2006-10-15 15:31:03 -04:00
|
|
|
case PM_ERR_PKG_HOLD:
|
2007-02-09 05:10:49 -05:00
|
|
|
/* TODO wow this is not descriptive at all... what does this mean? */
|
2006-10-15 15:31:03 -04:00
|
|
|
return _("not confirmed");
|
|
|
|
case PM_ERR_INVALID_REGEX:
|
2007-01-18 11:52:57 -05:00
|
|
|
return _("invalid regular expression");
|
2007-02-09 05:10:49 -05:00
|
|
|
/* Downloading */
|
2006-10-15 15:31:03 -04:00
|
|
|
case PM_ERR_CONNECT_FAILED:
|
|
|
|
return _("connection to remote host failed");
|
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: */
|