DBusError.newForDbusError
glib.error.ErrorWrap newForDbusError(string dbusErrorName, string dbusErrorMessage)Creates a #GError based on the contents of dbus_error_name and dbus_error_message.
Errors registered with [gio.global.dbusErrorRegisterError] 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.global.dbusErrorGetRemoteError] 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.global.dbusErrorEncodeGerror] 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 [gio.global.dbusErrorGetRemoteError].
Otherwise, a #GError with the error code [gio.types.IOErrorEnum.DbusError] 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.global.dbusErrorGetRemoteError].
In all three cases, dbus_error_name can always be recovered from the returned #GError using the [gio.global.dbusErrorGetRemoteError] function (unless [gio.global.dbusErrorStripRemoteError] 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.
Parameters
dbusErrorName | D-Bus error name. |
dbusErrorMessage | D-Bus error message. |