DBusError.newForDbusError

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.

struct DBusError
static
newForDbusError

Parameters

dbusErrorName string

D-Bus error name.

dbusErrorMessage string

D-Bus error message.

Return Value

Type: ErrorG

An allocated #GError. Free with g_error_free().

Meta

Since

2.26