00001 /* 00002 * error.c 00003 * 00004 * Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> 00005 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> 00006 * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> 00007 * Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 00023 #include "config.h" 00024 00025 /* libalpm */ 00026 #include "error.h" 00027 #include "util.h" 00028 #include "alpm.h" 00029 00030 /* TODO does this really need a file all on its own? */ 00031 const char SYMEXPORT *alpm_strerrorlast(void) 00032 { 00033 return alpm_strerror(pm_errno); 00034 } 00035 00036 const char SYMEXPORT *alpm_strerror(int err) 00037 { 00038 switch(err) { 00039 /* System */ 00040 case PM_ERR_MEMORY: 00041 return _("out of memory!"); 00042 case PM_ERR_SYSTEM: 00043 return _("unexpected system error"); 00044 case PM_ERR_BADPERMS: 00045 return _("insufficient privileges"); 00046 case PM_ERR_NOT_A_FILE: 00047 return _("could not find or read file"); 00048 case PM_ERR_NOT_A_DIR: 00049 return _("could not find or read directory"); 00050 case PM_ERR_WRONG_ARGS: 00051 return _("wrong or NULL argument passed"); 00052 /* Interface */ 00053 case PM_ERR_HANDLE_NULL: 00054 return _("library not initialized"); 00055 case PM_ERR_HANDLE_NOT_NULL: 00056 return _("library already initialized"); 00057 case PM_ERR_HANDLE_LOCK: 00058 return _("unable to lock database"); 00059 /* Databases */ 00060 case PM_ERR_DB_OPEN: 00061 return _("could not open database"); 00062 case PM_ERR_DB_CREATE: 00063 return _("could not create database"); 00064 case PM_ERR_DB_NULL: 00065 return _("database not initialized"); 00066 case PM_ERR_DB_NOT_NULL: 00067 return _("database already registered"); 00068 case PM_ERR_DB_NOT_FOUND: 00069 return _("could not find database"); 00070 case PM_ERR_DB_WRITE: 00071 return _("could not update database"); 00072 case PM_ERR_DB_REMOVE: 00073 return _("could not remove database entry"); 00074 /* Servers */ 00075 case PM_ERR_SERVER_BAD_URL: 00076 return _("invalid url for server"); 00077 /* Configuration */ 00078 case PM_ERR_OPT_LOGFILE: 00079 case PM_ERR_OPT_DBPATH: 00080 case PM_ERR_OPT_LOCALDB: 00081 case PM_ERR_OPT_SYNCDB: 00082 case PM_ERR_OPT_USESYSLOG: 00083 return _("could not set parameter"); 00084 /* Transactions */ 00085 case PM_ERR_TRANS_NOT_NULL: 00086 return _("transaction already initialized"); 00087 case PM_ERR_TRANS_NULL: 00088 return _("transaction not initialized"); 00089 case PM_ERR_TRANS_DUP_TARGET: 00090 return _("duplicate target"); 00091 case PM_ERR_TRANS_NOT_INITIALIZED: 00092 return _("transaction not initialized"); 00093 case PM_ERR_TRANS_NOT_PREPARED: 00094 return _("transaction not prepared"); 00095 case PM_ERR_TRANS_ABORT: 00096 return _("transaction aborted"); 00097 case PM_ERR_TRANS_TYPE: 00098 return _("operation not compatible with the transaction type"); 00099 case PM_ERR_TRANS_COMMITING: 00100 return _("could not commit transaction"); 00101 case PM_ERR_TRANS_DOWNLOADING: 00102 return _("could not download all files"); 00103 /* Packages */ 00104 case PM_ERR_PKG_NOT_FOUND: 00105 return _("could not find or read package"); 00106 case PM_ERR_PKG_INVALID: 00107 return _("invalid or corrupted package"); 00108 case PM_ERR_PKG_OPEN: 00109 return _("cannot open package file"); 00110 case PM_ERR_PKG_LOAD: 00111 return _("cannot load package data"); 00112 case PM_ERR_PKG_INSTALLED: 00113 return _("package already installed"); 00114 case PM_ERR_PKG_CANT_FRESH: 00115 return _("package not installed or lesser version"); 00116 case PM_ERR_PKG_CANT_REMOVE: 00117 return _("cannot remove all files for package"); 00118 case PM_ERR_PKG_INVALID_NAME: 00119 return _("package name is not valid"); 00120 case PM_ERR_PKG_CORRUPTED: 00121 return _("corrupted package"); 00122 case PM_ERR_PKG_REPO_NOT_FOUND: 00123 return _("no such repository"); 00124 /* Deltas */ 00125 case PM_ERR_DLT_CORRUPTED: 00126 return _("corrupted delta"); 00127 case PM_ERR_DLT_PATCHFAILED: 00128 return _("delta patch failed"); 00129 /* Groups */ 00130 case PM_ERR_GRP_NOT_FOUND: 00131 return _("group not found"); 00132 /* Dependencies */ 00133 case PM_ERR_UNSATISFIED_DEPS: 00134 return _("could not satisfy dependencies"); 00135 case PM_ERR_CONFLICTING_DEPS: 00136 return _("conflicting dependencies"); 00137 case PM_ERR_FILE_CONFLICTS: 00138 return _("conflicting files"); 00139 /* Miscellaenous */ 00140 case PM_ERR_USER_ABORT: 00141 return _("user aborted the operation"); 00142 case PM_ERR_INTERNAL_ERROR: 00143 return _("internal error"); 00144 case PM_ERR_LIBARCHIVE_ERROR: 00145 return _("libarchive error"); 00146 case PM_ERR_PKG_HOLD: 00147 /* TODO wow this is not descriptive at all... what does this mean? */ 00148 return _("not confirmed"); 00149 case PM_ERR_INVALID_REGEX: 00150 return _("invalid regular expression"); 00151 /* Downloading */ 00152 case PM_ERR_CONNECT_FAILED: 00153 return _("connection to remote host failed"); 00154 /* Unknown error! */ 00155 default: 00156 return _("unexpected error"); 00157 } 00158 } 00159 00160 /* vim: set ts=2 sw=2 noet: */
1.5.4