new_for_dbus_error


Description:

public static Error new_for_dbus_error (string dbus_error_name, string dbus_error_message)

Creates a Error based on the contents of dbus_error_name and dbus_error_message.

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

Otherwise, a Error 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 get_remote_error.

In all three cases, dbus_error_name can always be recovered from the returned Error using the get_remote_error function (unless strip_remote_error hasn't been used on the returned error).

This function is typically only used in object mappings to prepare 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 Error. Free with g_error_free.