Function
GioDBusErrornew_for_dbus_error
since: 2.26
Declaration [src]
GError*
g_dbus_error_new_for_dbus_error (
const gchar* dbus_error_name,
const gchar* dbus_error_message
)
Description [src]
Creates a GError based on the contents of dbus_error_name and
dbus_error_message.
Errors registered with g_dbus_error_register_error() will be looked
up using dbus_error_name and if a match is found, the error domain
and code is used. Applications can use g_dbus_error_get_remote_error()
to recover dbus_error_name.
If a match against a registered error is not found and the D-Bus
error name is in a form as returned by g_dbus_error_encode_gerror()
the error domain and code encoded in the name is used to
create the GError. Also, dbus_error_name is added to the error message
such that it can be recovered with g_dbus_error_get_remote_error().
Otherwise, a GError with the error code G_IO_ERROR_DBUS_ERROR
in the G_IO_ERROR error domain is returned. Also, dbus_error_name is
added to the error message such that it can be recovered with g_dbus_error_get_remote_error().
In all three cases, dbus_error_name can always be recovered from the
returned GError using the g_dbus_error_get_remote_error() function
(unless g_dbus_error_strip_remote_error() hasn’t been used on the returned error).
This function is typically only used in object mappings to prepare
GError instances for applications. Regular applications should not use it.
Available since: 2.26
Parameters
dbus_error_name-
Type:
const gchar*D-Bus error name.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. dbus_error_message-
Type:
const gchar*D-Bus error message.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string.
Return value
Type: GError
An allocated GError. Free with g_error_free().
| The caller of the function takes ownership of the data, and is responsible for freeing it. |