new_for_dbus_error


Description:

public static Error new_for_dbus_error (string dbus_error_name, string dbus_error_message)

Creates a [type@GLib.

Error] based on the contents of dbus_error_name and dbus_error_message.

Errors registered with [func@Gio.DBusError.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 [func@Gio.DBusError.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 [func@Gio.DBusError.encode_gerror] the error domain and code encoded in the name is used to create the [type@GLib.Error]. Also, dbus_error_name is added to the error message such that it can be recovered with [func@Gio.DBusError.get_remote_error].

Otherwise, a [type@GLib.Error] with the error code [error@Gio.IOErrorEnum.DBUS_ERROR] in the [error@Gio.IOErrorEnum] error domain is returned. Also, dbus_error_name is added to the error message such that it can be recovered with [func@Gio.DBusError.get_remote_error].

In all three cases, dbus_error_name can always be recovered from the returned [type@GLib.Error] using the [ func@Gio.DBusError.get_remote_error] function (unless [func@Gio.DBusError.strip_remote_error] hasn’t been used on the returned error).

This function is typically only used in object mappings to prepare [type@GLib.Error] instances for applications. Regular applications should not use it.

Parameters:

dbus_error_name

D-Bus error name

dbus_error_message

D-Bus error message

Returns:

an allocated [type@GLib.Error]