1 /* librepo - A library providing (libcURL like) API to downloading repository
2 * Copyright (C) 2012 Tomas Mlcoch
3 *
4 * Licensed under the GNU Lesser General Public License Version 2.1
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "rcodes.h"
22
23 const char *
lr_strerror(int rc)24 lr_strerror(int rc)
25 {
26 switch (rc) {
27 case LRE_OK:
28 return "No error";
29 case LRE_BADFUNCARG:
30 return "Bad function argument(s)";
31 case LRE_BADOPTARG:
32 return "Bad argument of a handle option";
33 case LRE_UNKNOWNOPT:
34 return "Unknown option";
35 case LRE_CURLSETOPT:
36 return "curl_*_setopt() failed (too old curl version?)";
37 case LRE_ALREADYUSEDRESULT:
38 return "LrResult object is not clean";
39 case LRE_INCOMPLETERESULT:
40 return "LrResult object doesn't contain all needed info";
41 case LRE_CURLDUP:
42 return "Cannot duplicate curl handle";
43 case LRE_CURL:
44 return "An Curl handle error";
45 case LRE_CURLM:
46 return "An Curl multi handle error";
47 case LRE_BADSTATUS:
48 return "Error HTTP/FTP status code";
49 case LRE_TEMPORARYERR:
50 return "Temporary error (operation timeout, ...), next try could work";
51 case LRE_NOTLOCAL:
52 return "Repository URL is not a local path";
53 case LRE_CANNOTCREATEDIR:
54 return "Cannot create output directory";
55 case LRE_IO:
56 return "Input/Output error";
57 case LRE_MLBAD:
58 return "Bad mirrorlist or metalink file";
59 case LRE_MLXML:
60 return "Metalink XML parse error";
61 case LRE_BADCHECKSUM:
62 return "Bad checksum";
63 case LRE_REPOMDXML:
64 return "repomd.xml XML parse error";
65 case LRE_NOURL:
66 return "Usable URL not found";
67 case LRE_CANNOTCREATETMP:
68 return "Cannot create temp directory";
69 case LRE_UNKNOWNCHECKSUM:
70 return "Unknown type of checksum is needed to verify one or more file(s)";
71 case LRE_BADURL:
72 return "Bad URL specified";
73 case LRE_GPGNOTSUPPORTED:
74 return "GPGME protocol is not supported";
75 case LRE_GPGERROR:
76 return "Error while GPG check";
77 case LRE_BADGPG:
78 return "Bad GPG signature";
79 case LRE_INCOMPLETEREPO:
80 return "Repository metadata are not complete";
81 case LRE_INTERRUPTED:
82 return "Interrupted by SIGINT";
83 case LRE_SIGACTION:
84 return "Cannot set own signal handler - sigaction system call failed";
85 case LRE_ALREADYDOWNLOADED:
86 return "File already exists and checksum is ok";
87 case LRE_UNFINISHED:
88 return "Download wasn't or cannot be finished";
89 case LRE_SELECT:
90 return "select() call failed";
91 case LRE_OPENSSL:
92 return "OpenSSL library related error";
93 case LRE_MEMORY:
94 return "Cannot allocate more memory";
95 case LRE_XMLPARSER:
96 return "XML parser error";
97 case LRE_CBINTERRUPTED:
98 return "Interrupted by user cb";
99 case LRE_REPOMD:
100 return "Error in repomd.xml";
101 case LRE_VALUE:
102 return "Bad value (no value, unknown unit, etc.)";
103 case LRE_NOTSET:
104 return "Requested option/value is not set";
105 case LRE_FILE:
106 return "File operation error";
107 case LRE_KEYFILE:
108 return "Key file parsing error";
109 }
110
111 return "Unknown error";
112 }
113
114 GQuark
lr_checksum_error_quark(void)115 lr_checksum_error_quark(void)
116 {
117 return g_quark_from_static_string("lr_checksum_error");
118 }
119
120 GQuark
lr_downloader_error_quark(void)121 lr_downloader_error_quark(void)
122 {
123 return g_quark_from_static_string("lr_downloader_error");
124 }
125
126 GQuark
lr_fastestmirror_error_quark(void)127 lr_fastestmirror_error_quark(void)
128 {
129 return g_quark_from_static_string("lr_fastestmirror_error");
130 }
131
132 GQuark
lr_gpg_error_quark(void)133 lr_gpg_error_quark(void)
134 {
135 return g_quark_from_static_string("lr_gpg_error");
136 }
137
138 GQuark
lr_handle_error_quark(void)139 lr_handle_error_quark(void)
140 {
141 return g_quark_from_static_string("lr_handle_error");
142 }
143
144 GQuark
lr_metalink_error_quark(void)145 lr_metalink_error_quark(void)
146 {
147 return g_quark_from_static_string("lr_metalink_error");
148 }
149
150 GQuark
lr_mirrorlist_error_quark(void)151 lr_mirrorlist_error_quark(void)
152 {
153 return g_quark_from_static_string("lr_mirrorlist_error");
154 }
155
156 GQuark
lr_package_downloader_error_quark(void)157 lr_package_downloader_error_quark(void)
158 {
159 return g_quark_from_static_string("lr_package_downloader_error");
160 }
161
162 GQuark
lr_xml_parser_error_quark(void)163 lr_xml_parser_error_quark(void)
164 {
165 return g_quark_from_static_string("lr_xml_parser_error");
166 }
167
168 GQuark
lr_repoconf_error_quark(void)169 lr_repoconf_error_quark(void)
170 {
171 return g_quark_from_static_string("lr_repoconf_error");
172 }
173
174 GQuark
lr_repomd_error_quark(void)175 lr_repomd_error_quark(void)
176 {
177 return g_quark_from_static_string("lr_repomd_error");
178 }
179
180 GQuark
lr_repoutil_yum_error_quark(void)181 lr_repoutil_yum_error_quark(void)
182 {
183 return g_quark_from_static_string("lr_repoutil_yum_error");
184 }
185
186 GQuark
lr_result_error_quark(void)187 lr_result_error_quark(void)
188 {
189 return g_quark_from_static_string("lr_result_error");
190 }
191
192 GQuark
lr_yum_error_quark(void)193 lr_yum_error_quark(void)
194 {
195 return g_quark_from_static_string("lr_yum_error");
196 }
197