Move important information up in -Si output
[pacman-ng.git] / lib / libalpm / error.c
blob86b4efb2a5a6b6782511bf4fe871436c5a83d03f
1 /*
2 * error.c
4 * Copyright (c) 2006-2012 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 #ifdef HAVE_LIBCURL
22 #include <curl/curl.h>
23 #endif
25 /* libalpm */
26 #include "util.h"
27 #include "alpm.h"
28 #include "handle.h"
30 alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle)
32 return handle->pm_errno;
35 const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
37 switch(err) {
38 /* System */
39 case ALPM_ERR_MEMORY:
40 return _("out of memory!");
41 case ALPM_ERR_SYSTEM:
42 return _("unexpected system error");
43 case ALPM_ERR_BADPERMS:
44 return _("permission denied");
45 case ALPM_ERR_NOT_A_FILE:
46 return _("could not find or read file");
47 case ALPM_ERR_NOT_A_DIR:
48 return _("could not find or read directory");
49 case ALPM_ERR_WRONG_ARGS:
50 return _("wrong or NULL argument passed");
51 case ALPM_ERR_DISK_SPACE:
52 return _("not enough free disk space");
53 /* Interface */
54 case ALPM_ERR_HANDLE_NULL:
55 return _("library not initialized");
56 case ALPM_ERR_HANDLE_NOT_NULL:
57 return _("library already initialized");
58 case ALPM_ERR_HANDLE_LOCK:
59 return _("unable to lock database");
60 /* Databases */
61 case ALPM_ERR_DB_OPEN:
62 return _("could not open database");
63 case ALPM_ERR_DB_CREATE:
64 return _("could not create database");
65 case ALPM_ERR_DB_NULL:
66 return _("database not initialized");
67 case ALPM_ERR_DB_NOT_NULL:
68 return _("database already registered");
69 case ALPM_ERR_DB_NOT_FOUND:
70 return _("could not find database");
71 case ALPM_ERR_DB_INVALID:
72 return _("invalid or corrupted database");
73 case ALPM_ERR_DB_INVALID_SIG:
74 return _("invalid or corrupted database (PGP signature)");
75 case ALPM_ERR_DB_VERSION:
76 return _("database is incorrect version");
77 case ALPM_ERR_DB_WRITE:
78 return _("could not update database");
79 case ALPM_ERR_DB_REMOVE:
80 return _("could not remove database entry");
81 /* Servers */
82 case ALPM_ERR_SERVER_BAD_URL:
83 return _("invalid url for server");
84 case ALPM_ERR_SERVER_NONE:
85 return _("no servers configured for repository");
86 /* Transactions */
87 case ALPM_ERR_TRANS_NOT_NULL:
88 return _("transaction already initialized");
89 case ALPM_ERR_TRANS_NULL:
90 return _("transaction not initialized");
91 case ALPM_ERR_TRANS_DUP_TARGET:
92 return _("duplicate target");
93 case ALPM_ERR_TRANS_NOT_INITIALIZED:
94 return _("transaction not initialized");
95 case ALPM_ERR_TRANS_NOT_PREPARED:
96 return _("transaction not prepared");
97 case ALPM_ERR_TRANS_ABORT:
98 return _("transaction aborted");
99 case ALPM_ERR_TRANS_TYPE:
100 return _("operation not compatible with the transaction type");
101 case ALPM_ERR_TRANS_NOT_LOCKED:
102 return _("transaction commit attempt when database is not locked");
103 /* Packages */
104 case ALPM_ERR_PKG_NOT_FOUND:
105 return _("could not find or read package");
106 case ALPM_ERR_PKG_IGNORED:
107 return _("operation cancelled due to ignorepkg");
108 case ALPM_ERR_PKG_INVALID:
109 return _("invalid or corrupted package");
110 case ALPM_ERR_PKG_INVALID_CHECKSUM:
111 return _("invalid or corrupted package (checksum)");
112 case ALPM_ERR_PKG_INVALID_SIG:
113 return _("invalid or corrupted package (PGP signature)");
114 case ALPM_ERR_PKG_OPEN:
115 return _("cannot open package file");
116 case ALPM_ERR_PKG_CANT_REMOVE:
117 return _("cannot remove all files for package");
118 case ALPM_ERR_PKG_INVALID_NAME:
119 return _("package filename is not valid");
120 case ALPM_ERR_PKG_INVALID_ARCH:
121 return _("package architecture is not valid");
122 case ALPM_ERR_PKG_REPO_NOT_FOUND:
123 return _("could not find repository for target");
124 /* Signatures */
125 case ALPM_ERR_SIG_MISSING:
126 return _("missing PGP signature");
127 case ALPM_ERR_SIG_INVALID:
128 return _("invalid PGP signature");
129 /* Deltas */
130 case ALPM_ERR_DLT_INVALID:
131 return _("invalid or corrupted delta");
132 case ALPM_ERR_DLT_PATCHFAILED:
133 return _("delta patch failed");
134 /* Dependencies */
135 case ALPM_ERR_UNSATISFIED_DEPS:
136 return _("could not satisfy dependencies");
137 case ALPM_ERR_CONFLICTING_DEPS:
138 return _("conflicting dependencies");
139 case ALPM_ERR_FILE_CONFLICTS:
140 return _("conflicting files");
141 /* Miscellaenous */
142 case ALPM_ERR_RETRIEVE:
143 return _("failed to retrieve some files");
144 case ALPM_ERR_INVALID_REGEX:
145 return _("invalid regular expression");
146 /* Errors from external libraries- our own wrapper error */
147 case ALPM_ERR_LIBARCHIVE:
148 /* it would be nice to use archive_error_string() here, but that
149 * requires the archive struct, so we can't. Just use a generic
150 * error string instead. */
151 return _("libarchive error");
152 case ALPM_ERR_LIBCURL:
153 return _("download library error");
154 case ALPM_ERR_GPGME:
155 return _("gpgme error");
156 case ALPM_ERR_EXTERNAL_DOWNLOAD:
157 return _("error invoking external downloader");
158 /* Unknown error! */
159 default:
160 return _("unexpected error");
164 /* vim: set ts=2 sw=2 noet: */