glibmm 2.80.0
Public Types | Public Member Functions | List of all members
Gio::Error Class Reference

Exception class for giomm errors. More...

#include <giomm/error.h>

Inheritance diagram for Gio::Error:
Inheritance graph
[legend]

Public Types

enum  Code {
  FAILED ,
  NOT_FOUND ,
  EXISTS ,
  IS_DIRECTORY ,
  NOT_DIRECTORY ,
  NOT_EMPTY ,
  NOT_REGULAR_FILE ,
  NOT_SYMBOLIC_LINK ,
  NOT_MOUNTABLE_FILE ,
  FILENAME_TOO_LONG ,
  INVALID_FILENAME ,
  TOO_MANY_LINKS ,
  NO_SPACE ,
  INVALID_ARGUMENT ,
  PERMISSION_DENIED ,
  NOT_SUPPORTED ,
  NOT_MOUNTED ,
  ALREADY_MOUNTED ,
  CLOSED ,
  CANCELLED ,
  PENDING ,
  READ_ONLY ,
  CANT_CREATE_BACKUP ,
  WRONG_ETAG ,
  TIMED_OUT ,
  WOULD_RECURSE ,
  BUSY ,
  WOULD_BLOCK ,
  HOST_NOT_FOUND ,
  HOST_WAS_NOT_FOUND = HOST_NOT_FOUND ,
  WOULD_MERGE ,
  FAILED_HANDLED ,
  TOO_MANY_OPEN_FILES ,
  NOT_INITIALIZED ,
  ADDRESS_IN_USE ,
  PARTIAL_INPUT ,
  INVALID_DATA ,
  DBUS_ERROR ,
  HOST_UNREACHABLE ,
  NETWORK_UNREACHABLE ,
  CONNECTION_REFUSED ,
  PROXY_FAILED ,
  PROXY_AUTH_FAILED ,
  PROXY_NEED_AUTH ,
  PROXY_NOT_ALLOWED ,
  BROKEN_PIPE ,
  CONNECTION_CLOSED = BROKEN_PIPE ,
  NOT_CONNECTED ,
  MESSAGE_TOO_LARGE ,
  NO_SUCH_DEVICE ,
  DESTINATION_UNSET
}
 Error codes returned by GIO functions. More...
 

Public Member Functions

 Error (Code error_code, const Glib::ustring & error_message)
 
 Error (GError * gobject)
 
Code code () const
 
- Public Member Functions inherited from Glib::Error
 Error ()
 
 Error (GQuark error_domain, int error_code, const Glib::ustring & message)
 
 Error (GError * gobject, bool take_copy=false)
 
 Error (const Error & other)
 
Erroroperator= (const Error & other)
 
 ~Error () noexcept override
 
 operator bool () const
 Test whether the Error has an underlying instance. More...
 
GQuark domain () const
 
int code () const
 
const char * what () const noexcept override
 
bool matches (GQuark error_domain, int error_code) const
 
GError * gobj ()
 
const GError * gobj () const
 
virtual const char * what () const noexcept
 

Additional Inherited Members

- Protected Attributes inherited from Glib::Error
GError * gobject_
 

Detailed Description

Exception class for giomm errors.

Member Enumeration Documentation

◆ Code

Error codes returned by GIO functions.

Note that this domain may be extended in future GLib releases. In general, new error codes either only apply to new APIs, or else replace Gio::Error::FAILED in cases that were not explicitly distinguished before. You should therefore avoid writing code like

[C example ellipted] but should instead treat all unrecognized error codes the same as Gio::Error::FAILED.

See also PollableReturn for a cheaper way of returning Gio::Error::WOULD_BLOCK to callers without allocating a Error.

Enumerator
FAILED 

Generic error condition for when an operation fails and no more specific Gio::Error value is defined.

NOT_FOUND 

File not found.

EXISTS 

File already exists.

IS_DIRECTORY 

File is a directory.

NOT_DIRECTORY 

File is not a directory.

NOT_EMPTY 

File is a directory that isn't empty.

NOT_REGULAR_FILE 

File is not a regular file.

NOT_SYMBOLIC_LINK 

File is not a symbolic link.

NOT_MOUNTABLE_FILE 

File cannot be mounted.

FILENAME_TOO_LONG 

Filename is too many characters.

INVALID_FILENAME 

Filename is invalid or contains invalid characters.

TOO_MANY_LINKS 

File contains too many symbolic links.

NO_SPACE 

No space left on drive.

INVALID_ARGUMENT 

Invalid argument.

PERMISSION_DENIED 

Permission denied.

NOT_SUPPORTED 

Operation (or one of its parameters) not supported.

NOT_MOUNTED 

File isn't mounted.

ALREADY_MOUNTED 

File is already mounted.

CLOSED 

File was closed.

CANCELLED 

Operation was cancelled.

See Cancellable.

PENDING 

Operations are still pending.

READ_ONLY 

File is read only.

CANT_CREATE_BACKUP 

Backup couldn't be created.

WRONG_ETAG 

File's Entity Tag was incorrect.

TIMED_OUT 

Operation timed out.

WOULD_RECURSE 

Operation would be recursive.

BUSY 

File is busy.

WOULD_BLOCK 

Operation would block.

HOST_NOT_FOUND 

Host couldn't be found (remote operations).

HOST_WAS_NOT_FOUND 
WOULD_MERGE 

Operation would merge files.

FAILED_HANDLED 

Operation failed and a helper program has already interacted with the user.

Do not display any error dialog.

TOO_MANY_OPEN_FILES 

The current process has too many files open and can't open any more.

Duplicate descriptors do count toward this limit.

Since glibmm 2.20:
NOT_INITIALIZED 

The object has not been initialized.

Since glibmm 2.22:
ADDRESS_IN_USE 

The requested address is already in use.

Since glibmm 2.22:
PARTIAL_INPUT 

Need more input to finish operation.

Since glibmm 2.24:
INVALID_DATA 

The input data was invalid.

Since glibmm 2.24:
DBUS_ERROR 

A remote object generated an error that doesn't correspond to a locally registered Error error domain.

Use g_dbus_error_get_remote_error() to extract the D-Bus error name and g_dbus_error_strip_remote_error() to fix up the message so it matches what was received on the wire.

Since glibmm 2.26:
HOST_UNREACHABLE 

Host unreachable.

Since glibmm 2.26:
NETWORK_UNREACHABLE 

Network unreachable.

Since glibmm 2.26:
CONNECTION_REFUSED 

Connection refused.

Since glibmm 2.26:
PROXY_FAILED 

Connection to proxy server failed.

Since glibmm 2.26:
PROXY_AUTH_FAILED 

Proxy authentication failed.

Since glibmm 2.26:
PROXY_NEED_AUTH 

Proxy server needs authentication.

Since glibmm 2.26:
PROXY_NOT_ALLOWED 

Proxy connection is not allowed by ruleset.

Since glibmm 2.26:
BROKEN_PIPE 

Broken pipe.

Since glibmm 2.36:
CONNECTION_CLOSED 

Connection closed by peer.

Note that this is the same code as Gio::Error::BROKEN_PIPE; before 2.44 some "connection closed" errors returned Gio::Error::BROKEN_PIPE, but others returned Gio::Error::FAILED. Now they should all return the same value, which has this more logical name.

Since glibmm 2.44:
NOT_CONNECTED 

Transport endpoint is not connected.

Since glibmm 2.44:
MESSAGE_TOO_LARGE 

Message too large.

Since glibmm 2.48:
NO_SUCH_DEVICE 

No such device found.

Since glibmm 2.74:
DESTINATION_UNSET 

Destination address unset.

Since glibmm 2.80:

Constructor & Destructor Documentation

◆ Error() [1/2]

Gio::Error::Error ( Code  error_code,
const Glib::ustring error_message 
)

◆ Error() [2/2]

Gio::Error::Error ( GError *  gobject)
explicit

Member Function Documentation

◆ code()

Code Gio::Error::code ( ) const