pacman: list all unknown targets on removal operation
[pacman-ng.git] / lib / libalpm / error.c
blob044dec7cbeb8360c5481d429afa0077d05e4a107
1 /*
2 * error.c
4 * Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
5 * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "config.h"
23 #ifdef HAVE_LIBCURL
24 #include <curl/curl.h>
25 #endif
27 /* libalpm */
28 #include "util.h"
29 #include "alpm.h"
30 #include "handle.h"
32 alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
34 return handle->pm_errno;
37 const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
39 switch(err) {
40 /* System */
41 case ALPM_ERR_MEMORY:
42 return _("out of memory!");
43 case ALPM_ERR_SYSTEM:
44 return _("unexpected system error");
45 case ALPM_ERR_BADPERMS:
46 return _("insufficient privileges");
47 case ALPM_ERR_NOT_A_FILE:
48 return _("could not find or read file");
49 case ALPM_ERR_NOT_A_DIR:
50 return _("could not find or read directory");
51 case ALPM_ERR_WRONG_ARGS:
52 return _("wrong or NULL argument passed");
53 case ALPM_ERR_DISK_SPACE:
54 return _("not enough free disk space");
55 /* Interface */
56 case ALPM_ERR_HANDLE_NULL:
57 return _("library not initialized");
58 case ALPM_ERR_HANDLE_NOT_NULL:
59 return _("library already initialized");
60 case ALPM_ERR_HANDLE_LOCK:
61 return _("unable to lock database");
62 /* Databases */
63 case ALPM_ERR_DB_OPEN:
64 return _("could not open database");
65 case ALPM_ERR_DB_CREATE:
66 return _("could not create database");
67 case ALPM_ERR_DB_NULL:
68 return _("database not initialized");
69 case ALPM_ERR_DB_NOT_NULL:
70 return _("database already registered");
71 case ALPM_ERR_DB_NOT_FOUND:
72 return _("could not find database");
73 case ALPM_ERR_DB_INVALID:
74 return _("invalid or corrupted database");
75 case ALPM_ERR_DB_INVALID_SIG:
76 return _("invalid or corrupted database (PGP signature)");
77 case ALPM_ERR_DB_VERSION:
78 return _("database is incorrect version");
79 case ALPM_ERR_DB_WRITE:
80 return _("could not update database");
81 case ALPM_ERR_DB_REMOVE:
82 return _("could not remove database entry");
83 /* Servers */
84 case ALPM_ERR_SERVER_BAD_URL:
85 return _("invalid url for server");
86 case ALPM_ERR_SERVER_NONE:
87 return _("no servers configured for repository");
88 /* Transactions */
89 case ALPM_ERR_TRANS_NOT_NULL:
90 return _("transaction already initialized");
91 case ALPM_ERR_TRANS_NULL:
92 return _("transaction not initialized");
93 case ALPM_ERR_TRANS_DUP_TARGET:
94 return _("duplicate target");
95 case ALPM_ERR_TRANS_NOT_INITIALIZED:
96 return _("transaction not initialized");
97 case ALPM_ERR_TRANS_NOT_PREPARED:
98 return _("transaction not prepared");
99 case ALPM_ERR_TRANS_ABORT:
100 return _("transaction aborted");
101 case ALPM_ERR_TRANS_TYPE:
102 return _("operation not compatible with the transaction type");
103 case ALPM_ERR_TRANS_NOT_LOCKED:
104 return _("transaction commit attempt when database is not locked");
105 /* Packages */
106 case ALPM_ERR_PKG_NOT_FOUND:
107 return _("could not find or read package");
108 case ALPM_ERR_PKG_IGNORED:
109 return _("operation cancelled due to ignorepkg");
110 case ALPM_ERR_PKG_INVALID:
111 return _("invalid or corrupted package");
112 case ALPM_ERR_PKG_INVALID_CHECKSUM:
113 return _("invalid or corrupted package (checksum)");
114 case ALPM_ERR_PKG_INVALID_SIG:
115 return _("invalid or corrupted package (PGP signature)");
116 case ALPM_ERR_PKG_OPEN:
117 return _("cannot open package file");
118 case ALPM_ERR_PKG_CANT_REMOVE:
119 return _("cannot remove all files for package");
120 case ALPM_ERR_PKG_INVALID_NAME:
121 return _("package filename is not valid");
122 case ALPM_ERR_PKG_INVALID_ARCH:
123 return _("package architecture is not valid");
124 case ALPM_ERR_PKG_REPO_NOT_FOUND:
125 return _("could not find repository for target");
126 /* Signatures */
127 case ALPM_ERR_SIG_MISSING:
128 return _("missing PGP signature");
129 case ALPM_ERR_SIG_INVALID:
130 return _("invalid PGP signature");
131 /* Deltas */
132 case ALPM_ERR_DLT_INVALID:
133 return _("invalid or corrupted delta");
134 case ALPM_ERR_DLT_PATCHFAILED:
135 return _("delta patch failed");
136 /* Dependencies */
137 case ALPM_ERR_UNSATISFIED_DEPS:
138 return _("could not satisfy dependencies");
139 case ALPM_ERR_CONFLICTING_DEPS:
140 return _("conflicting dependencies");
141 case ALPM_ERR_FILE_CONFLICTS:
142 return _("conflicting files");
143 /* Miscellaenous */
144 case ALPM_ERR_RETRIEVE:
145 return _("failed to retrieve some files");
146 case ALPM_ERR_INVALID_REGEX:
147 return _("invalid regular expression");
148 /* Errors from external libraries- our own wrapper error */
149 case ALPM_ERR_LIBARCHIVE:
150 /* it would be nice to use archive_error_string() here, but that
151 * requires the archive struct, so we can't. Just use a generic
152 * error string instead. */
153 return _("libarchive error");
154 case ALPM_ERR_LIBCURL:
155 return _("download library error");
156 case ALPM_ERR_GPGME:
157 return _("gpgme error");
158 case ALPM_ERR_EXTERNAL_DOWNLOAD:
159 return _("error invoking external downloader");
160 /* Unknown error! */
161 default:
162 return _("unexpected error");
166 /* vim: set ts=2 sw=2 noet: */