1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY! 2 #ifndef _GIOMM_ERROR_H 3 #define _GIOMM_ERROR_H 4 5 #include <giommconfig.h> 6 7 8 #include <glibmm/ustring.h> 9 #include <sigc++/sigc++.h> 10 11 /* Copyright (C) 2007 The giomm Development Team 12 * 13 * This library is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU Lesser General Public 15 * License as published by the Free Software Foundation; either 16 * version 2.1 of the License, or (at your option) any later version. 17 * 18 * This library is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * Lesser General Public License for more details. 22 * 23 * You should have received a copy of the GNU Lesser General Public 24 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 25 */ 26 27 28 #include <glibmm/error.h> 29 #include <glibmm/interface.h> 30 31 // There have been issues with other libraries defining HOST_NOT_FOUND (e.g. 32 // netdb.h). As a workaround, we added the alternate name HOST_WAS_NOT_FOUND. 33 // Portable code should not use HOST_NOT_FOUND. Undefining it here (and 34 // restoring it below) will allow programs to compile even if they include 35 // netdb.h. See Bug #529496 36 #ifdef HOST_NOT_FOUND 37 #define GIOMM_SAVED_HOST_NOT_FOUND HOST_NOT_FOUND 38 #undef HOST_NOT_FOUND 39 #endif // HOST_NOT_FOUND 40 41 42 namespace Gio 43 { 44 45 //Note that GIOErrorEnum is not named GIOError in gio because there is already a GIOError in glib, 46 //But we can have both Glib::Error and Gio::Error in C++. 47 48 /** %Exception class for giomm errors. 49 */ 50 class GIOMM_API Error : public Glib::Error 51 { 52 public: 53 /** @var Code FAILED 54 * Generic error condition for when an operation fails 55 * and no more specific IOErrorEnum value is defined. 56 * 57 * @var Code NOT_FOUND 58 * File not found. 59 * 60 * @var Code EXISTS 61 * File already exists. 62 * 63 * @var Code IS_DIRECTORY 64 * File is a directory. 65 * 66 * @var Code NOT_DIRECTORY 67 * File is not a directory. 68 * 69 * @var Code NOT_EMPTY 70 * File is a directory that isn't empty. 71 * 72 * @var Code NOT_REGULAR_FILE 73 * File is not a regular file. 74 * 75 * @var Code NOT_SYMBOLIC_LINK 76 * File is not a symbolic link. 77 * 78 * @var Code NOT_MOUNTABLE_FILE 79 * File cannot be mounted. 80 * 81 * @var Code FILENAME_TOO_LONG 82 * Filename is too many characters. 83 * 84 * @var Code INVALID_FILENAME 85 * Filename is invalid or contains invalid characters. 86 * 87 * @var Code TOO_MANY_LINKS 88 * File contains too many symbolic links. 89 * 90 * @var Code NO_SPACE 91 * No space left on drive. 92 * 93 * @var Code INVALID_ARGUMENT 94 * Invalid argument. 95 * 96 * @var Code PERMISSION_DENIED 97 * Permission denied. 98 * 99 * @var Code NOT_SUPPORTED 100 * Operation (or one of its parameters) not supported. 101 * 102 * @var Code NOT_MOUNTED 103 * File isn't mounted. 104 * 105 * @var Code ALREADY_MOUNTED 106 * File is already mounted. 107 * 108 * @var Code CLOSED 109 * File was closed. 110 * 111 * @var Code CANCELLED 112 * Operation was cancelled. See Cancellable. 113 * 114 * @var Code PENDING 115 * Operations are still pending. 116 * 117 * @var Code READ_ONLY 118 * File is read only. 119 * 120 * @var Code CANT_CREATE_BACKUP 121 * Backup couldn't be created. 122 * 123 * @var Code WRONG_ETAG 124 * File's Entity Tag was incorrect. 125 * 126 * @var Code TIMED_OUT 127 * Operation timed out. 128 * 129 * @var Code WOULD_RECURSE 130 * Operation would be recursive. 131 * 132 * @var Code BUSY 133 * File is busy. 134 * 135 * @var Code WOULD_BLOCK 136 * Operation would block. 137 * 138 * @var Code HOST_NOT_FOUND 139 * Host couldn't be found (remote operations). 140 * 141 * @var Code WOULD_MERGE 142 * Operation would merge files. 143 * 144 * @var Code FAILED_HANDLED 145 * Operation failed and a helper program has 146 * already interacted with the user. Do not display any error dialog. 147 * 148 * @var Code TOO_MANY_OPEN_FILES 149 * The current process has too many files 150 * open and can't open any more. Duplicate descriptors do count toward 151 * this limit. @newin{2,20} 152 * 153 * @var Code NOT_INITIALIZED 154 * The object has not been initialized. @newin{2,22} 155 * 156 * @var Code ADDRESS_IN_USE 157 * The requested address is already in use. @newin{2,22} 158 * 159 * @var Code PARTIAL_INPUT 160 * Need more input to finish operation. @newin{2,24} 161 * 162 * @var Code INVALID_DATA 163 * The input data was invalid. @newin{2,24} 164 * 165 * @var Code DBUS_ERROR 166 * A remote object generated an error that 167 * doesn't correspond to a locally registered Error error 168 * domain. Use g_dbus_error_get_remote_error() to extract the D-Bus 169 * error name and g_dbus_error_strip_remote_error() to fix up the 170 * message so it matches what was received on the wire. @newin{2,26} 171 * 172 * @var Code HOST_UNREACHABLE 173 * Host unreachable. @newin{2,26} 174 * 175 * @var Code NETWORK_UNREACHABLE 176 * Network unreachable. @newin{2,26} 177 * 178 * @var Code CONNECTION_REFUSED 179 * Connection refused. @newin{2,26} 180 * 181 * @var Code PROXY_FAILED 182 * Connection to proxy server failed. @newin{2,26} 183 * 184 * @var Code PROXY_AUTH_FAILED 185 * Proxy authentication failed. @newin{2,26} 186 * 187 * @var Code PROXY_NEED_AUTH 188 * Proxy server needs authentication. @newin{2,26} 189 * 190 * @var Code PROXY_NOT_ALLOWED 191 * Proxy connection is not allowed by ruleset. 192 * @newin{2,26} 193 * 194 * @var Code BROKEN_PIPE 195 * Broken pipe. @newin{2,36} 196 * 197 * @var Code CONNECTION_CLOSED 198 * Connection closed by peer. Note that this 199 * is the same code as IO_ERROR_BROKEN_PIPE; before 2.44 some 200 * "connection closed" errors returned IO_ERROR_BROKEN_PIPE, but others 201 * returned IO_ERROR_FAILED. Now they should all return the same 202 * value, which has this more logical name. @newin{2,44} 203 * 204 * @var Code NOT_CONNECTED 205 * Transport endpoint is not connected. @newin{2,44} 206 * 207 * @var Code MESSAGE_TOO_LARGE 208 * Message too large. @newin{2,48} 209 * 210 * @enum Code 211 * 212 * %Error codes returned by GIO functions. 213 * 214 * Note that this domain may be extended in future GLib releases. In 215 * general, new error codes either only apply to new APIs, or else 216 * replace IO_ERROR_FAILED in cases that were not explicitly 217 * distinguished before. You should therefore avoid writing code like 218 * 219 * [C example ellipted] 220 * but should instead treat all unrecognized error codes the same as 221 * IO_ERROR_FAILED. 222 * 223 * See also PollableReturn for a cheaper way of returning 224 * IO_ERROR_WOULD_BLOCK to callers without allocating a Error. 225 */ 226 enum Code 227 { 228 FAILED, 229 NOT_FOUND, 230 EXISTS, 231 IS_DIRECTORY, 232 NOT_DIRECTORY, 233 NOT_EMPTY, 234 NOT_REGULAR_FILE, 235 NOT_SYMBOLIC_LINK, 236 NOT_MOUNTABLE_FILE, 237 FILENAME_TOO_LONG, 238 INVALID_FILENAME, 239 TOO_MANY_LINKS, 240 NO_SPACE, 241 INVALID_ARGUMENT, 242 PERMISSION_DENIED, 243 NOT_SUPPORTED, 244 NOT_MOUNTED, 245 ALREADY_MOUNTED, 246 CLOSED, 247 CANCELLED, 248 PENDING, 249 READ_ONLY, 250 CANT_CREATE_BACKUP, 251 WRONG_ETAG, 252 TIMED_OUT, 253 WOULD_RECURSE, 254 BUSY, 255 WOULD_BLOCK, 256 HOST_NOT_FOUND, 257 HOST_WAS_NOT_FOUND = HOST_NOT_FOUND, 258 WOULD_MERGE, 259 FAILED_HANDLED, 260 TOO_MANY_OPEN_FILES, 261 NOT_INITIALIZED, 262 ADDRESS_IN_USE, 263 PARTIAL_INPUT, 264 INVALID_DATA, 265 DBUS_ERROR, 266 HOST_UNREACHABLE, 267 NETWORK_UNREACHABLE, 268 CONNECTION_REFUSED, 269 PROXY_FAILED, 270 PROXY_AUTH_FAILED, 271 PROXY_NEED_AUTH, 272 PROXY_NOT_ALLOWED, 273 BROKEN_PIPE, 274 CONNECTION_CLOSED = BROKEN_PIPE, 275 NOT_CONNECTED, 276 MESSAGE_TOO_LARGE 277 }; 278 279 Error(Code error_code, const Glib::ustring& error_message); 280 explicit Error(GError* gobject); 281 Code code() const; 282 283 #ifndef DOXYGEN_SHOULD_SKIP_THIS 284 private: 285 286 static void throw_func(GError* gobject); 287 288 friend GIOMM_API void wrap_init(); // uses throw_func() 289 290 #endif //DOXYGEN_SHOULD_SKIP_THIS 291 }; 292 293 294 class GIOMM_API ResolverError : public Glib::Error 295 { 296 public: 297 /** @var Code NOT_FOUND 298 * The requested name/address/service was not 299 * found. 300 * 301 * @var Code TEMPORARY_FAILURE 302 * The requested information could not 303 * be looked up due to a network error or similar problem. 304 * 305 * @var Code INTERNAL 306 * Unknown error. 307 * 308 * @enum Code 309 * 310 * An error code used with G_RESOLVER_ERROR in a Error returned 311 * from a Resolver routine. 312 * 313 * @newin{2,22} 314 */ 315 enum Code 316 { 317 NOT_FOUND, 318 TEMPORARY_FAILURE, 319 INTERNAL 320 }; 321 322 ResolverError(Code error_code, const Glib::ustring& error_message); 323 explicit ResolverError(GError* gobject); 324 Code code() const; 325 326 #ifndef DOXYGEN_SHOULD_SKIP_THIS 327 private: 328 329 static void throw_func(GError* gobject); 330 331 friend GIOMM_API void wrap_init(); // uses throw_func() 332 333 #endif //DOXYGEN_SHOULD_SKIP_THIS 334 }; 335 336 337 class GIOMM_API TlsError : public Glib::Error 338 { 339 public: 340 /** @var Code UNAVAILABLE 341 * No TLS provider is available. 342 * 343 * @var Code MISC 344 * Miscellaneous TLS error. 345 * 346 * @var Code BAD_CERTIFICATE 347 * The certificate presented could not 348 * be parsed or failed validation. 349 * 350 * @var Code NOT_TLS 351 * The TLS handshake failed because the 352 * peer does not seem to be a TLS server. 353 * 354 * @var Code HANDSHAKE 355 * The TLS handshake failed because the 356 * peer's certificate was not acceptable. 357 * 358 * @var Code CERTIFICATE_REQUIRED 359 * The TLS handshake failed because 360 * the server requested a client-side certificate, but none was 361 * provided. See g_tls_connection_set_certificate(). 362 * 363 * @var Code ENDOFFILE 364 * The TLS connection was closed without proper 365 * notice, which may indicate an attack. See 366 * g_tls_connection_set_require_close_notify(). 367 * 368 * @var Code INAPPROPRIATE_FALLBACK 369 * The TLS handshake failed 370 * because the client sent the fallback SCSV, indicating a protocol 371 * downgrade attack. @newin{2,60} 372 * 373 * @enum Code 374 * 375 * An error code used with G_TLS_ERROR in a Error returned from a 376 * TLS-related routine. 377 * 378 * @newin{2,28} 379 */ 380 enum Code 381 { 382 UNAVAILABLE, 383 MISC, 384 BAD_CERTIFICATE, 385 NOT_TLS, 386 HANDSHAKE, 387 CERTIFICATE_REQUIRED, 388 ENDOFFILE, 389 INAPPROPRIATE_FALLBACK 390 }; 391 392 TlsError(Code error_code, const Glib::ustring& error_message); 393 explicit TlsError(GError* gobject); 394 Code code() const; 395 396 #ifndef DOXYGEN_SHOULD_SKIP_THIS 397 private: 398 399 static void throw_func(GError* gobject); 400 401 friend GIOMM_API void wrap_init(); // uses throw_func() 402 403 #endif //DOXYGEN_SHOULD_SKIP_THIS 404 }; 405 406 407 } // namespace Gio 408 409 #ifdef GIOMM_SAVED_HOST_NOT_FOUND 410 // restore the previously-defined HOST_NOT_FOUND macro 411 #define HOST_NOT_FOUND GIOMM_SAVED_HOST_NOT_FOUND 412 #undef GIOMM_SAVED_HOST_NOT_FOUND 413 #endif // GIOMM_SAVED_HOST_NOT_FOUND 414 415 416 #endif /* _GIOMM_ERROR_H */ 417 418