Gio.DBusError.new_for_dbus_error
function new_for_dbus_error(dbus_error_name: String, dbus_error_message: String): GLib.Error {
// Gjs wrapper for g_dbus_error_new_for_dbus_error()
}
Creates a GLib.Error based on the contents of dbus_error_name and dbus_error_message.
Errors registered with Gio.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 Gio.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 Gio.dbus_error_encode_gerror the error domain and code encoded in the name is used to create the GLib.Error. Also, dbus_error_name is added to the error message such that it can be recovered with Gio.dbus_error_get_remote_error.
Otherwise, a GLib.Error with the error code Gio.IOErrorEnum.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 Gio.dbus_error_get_remote_error.
In all three cases, dbus_error_name can always be recovered from the returned GLib.Error using the Gio.dbus_error_get_remote_error function (unless Gio.dbus_error_strip_remote_error hasn't been used on the returned error).
This function is typically only used in object mappings to prepare GLib.Error instances for applications. Regular applications should not use it.
Since 2.26
- dbus_error_name
D-Bus error name.
- dbus_error_message
D-Bus error message.
- Returns
An allocated GLib.Error. Free with GLib.Error.prototype.free.