:right-sidebar: True DBusError =================================================================== .. currentmodule:: gi.repository.Gio .. versionadded:: 2.26 .. class:: DBusError :no-contents-entry: Error codes for the %G_DBUS_ERROR error domain. Methods ------- .. rst-class:: interim-class .. class:: DBusError :no-index: .. method:: encode_gerror() -> str Creates a D-Bus error name to use for ``error``\. If ``error`` matches a registered error (cf. g_dbus_error_register_error()), the corresponding D-Bus error name will be returned. Otherwise the a name of the form ``org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE`` will be used. This allows other GDBus applications to map the error on the wire back to a :obj:`~gi.repository.GLib.Error` using g_dbus_error_new_for_dbus_error(). This function is typically only used in object mappings to put a :obj:`~gi.repository.GLib.Error` on the wire. Regular applications should not use it. .. versionadded:: 2.26 .. method:: get_remote_error() -> str | None Gets the D-Bus error name used for ``error``\, if any. This function is guaranteed to return a D-Bus error name for all :obj:`~gi.repository.GLib.Error` returned from functions handling remote method calls (e.g. :func:`~gi.repository.Gio.DBusConnection.call_finish`) unless g_dbus_error_strip_remote_error() has been used on ``error``\. .. versionadded:: 2.26 .. method:: is_remote_error() -> bool Checks if ``error`` represents an error received via D-Bus from a remote peer. If so, use g_dbus_error_get_remote_error() to get the name of the error. .. versionadded:: 2.26 .. method:: new_for_dbus_error(dbus_error_message: str) -> ~gi.repository.GLib.GError Creates a :obj:`~gi.repository.GLib.Error` 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 :obj:`~gi.repository.GLib.Error`\. 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 :obj:`~gi.repository.GLib.Error` with the error code :const:`~gi.repository.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 g_dbus_error_get_remote_error(). In all three cases, ``dbus_error_name`` can always be recovered from the returned :obj:`~gi.repository.GLib.Error` 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 :obj:`~gi.repository.GLib.Error` instances for applications. Regular applications should not use it. .. versionadded:: 2.26 :param dbus_error_message: D-Bus error message. .. method:: quark() -> int .. method:: register_error(error_code: int, dbus_error_name: str) -> bool Creates an association to map between ``dbus_error_name`` and :obj:`~gi.repository.GLib.Error` specified by ``error_domain`` and ``error_code``\. This is typically done in the routine that returns the :obj:`~gi.repository.GLib.Quark` for an error domain. .. versionadded:: 2.26 :param error_code: An error code. :param dbus_error_name: A D-Bus error name. .. method:: register_error_domain(quark_volatile: int, entries: list[~gi.repository.Gio.DBusErrorEntry]) -> None Helper function for associating a :obj:`~gi.repository.GLib.Error` error domain with D-Bus error names. While ``quark_volatile`` has a ``volatile`` qualifier, this is a historical artifact and the argument passed to it should not be ``volatile``\. .. versionadded:: 2.26 :param quark_volatile: A pointer where to store the :obj:`~gi.repository.GLib.Quark`\. :param entries: A pointer to ``num_entries`` :obj:`~gi.repository.Gio.DBusErrorEntry` struct items. .. method:: strip_remote_error() -> bool Looks for extra information in the error message used to recover the D-Bus error name and strips it if found. If stripped, the message field in ``error`` will correspond exactly to what was received on the wire. This is typically used when presenting errors to the end user. .. versionadded:: 2.26 .. method:: unregister_error(error_code: int, dbus_error_name: str) -> bool Destroys an association previously set up with g_dbus_error_register_error(). .. versionadded:: 2.26 :param error_code: An error code. :param dbus_error_name: A D-Bus error name. Fields ------ .. rst-class:: interim-class .. class:: DBusError :no-index: .. attribute:: ACCESS_DENIED The type of the None singleton. .. attribute:: ADDRESS_IN_USE The type of the None singleton. .. attribute:: ADT_AUDIT_DATA_UNKNOWN The type of the None singleton. .. attribute:: AUTH_FAILED The type of the None singleton. .. attribute:: BAD_ADDRESS The type of the None singleton. .. attribute:: DISCONNECTED The type of the None singleton. .. attribute:: FAILED The type of the None singleton. .. attribute:: FILE_EXISTS The type of the None singleton. .. attribute:: FILE_NOT_FOUND The type of the None singleton. .. attribute:: INVALID_ARGS The type of the None singleton. .. attribute:: INVALID_FILE_CONTENT The type of the None singleton. .. attribute:: INVALID_SIGNATURE The type of the None singleton. .. attribute:: IO_ERROR The type of the None singleton. .. attribute:: LIMITS_EXCEEDED The type of the None singleton. .. attribute:: MATCH_RULE_INVALID The type of the None singleton. .. attribute:: MATCH_RULE_NOT_FOUND The type of the None singleton. .. attribute:: NAME_HAS_NO_OWNER The type of the None singleton. .. attribute:: NOT_SUPPORTED The type of the None singleton. .. attribute:: NO_MEMORY The type of the None singleton. .. attribute:: NO_NETWORK The type of the None singleton. .. attribute:: NO_REPLY The type of the None singleton. .. attribute:: NO_SERVER The type of the None singleton. .. attribute:: OBJECT_PATH_IN_USE The type of the None singleton. .. attribute:: PROPERTY_READ_ONLY The type of the None singleton. .. attribute:: SELINUX_SECURITY_CONTEXT_UNKNOWN The type of the None singleton. .. attribute:: SERVICE_UNKNOWN The type of the None singleton. .. attribute:: SPAWN_CHILD_EXITED The type of the None singleton. .. attribute:: SPAWN_CHILD_SIGNALED The type of the None singleton. .. attribute:: SPAWN_CONFIG_INVALID The type of the None singleton. .. attribute:: SPAWN_EXEC_FAILED The type of the None singleton. .. attribute:: SPAWN_FAILED The type of the None singleton. .. attribute:: SPAWN_FILE_INVALID The type of the None singleton. .. attribute:: SPAWN_FORK_FAILED The type of the None singleton. .. attribute:: SPAWN_NO_MEMORY The type of the None singleton. .. attribute:: SPAWN_PERMISSIONS_INVALID The type of the None singleton. .. attribute:: SPAWN_SERVICE_INVALID The type of the None singleton. .. attribute:: SPAWN_SERVICE_NOT_FOUND The type of the None singleton. .. attribute:: SPAWN_SETUP_FAILED The type of the None singleton. .. attribute:: TIMED_OUT The type of the None singleton. .. attribute:: TIMEOUT The type of the None singleton. .. attribute:: UNIX_PROCESS_ID_UNKNOWN The type of the None singleton. .. attribute:: UNKNOWN_INTERFACE The type of the None singleton. .. attribute:: UNKNOWN_METHOD The type of the None singleton. .. attribute:: UNKNOWN_OBJECT The type of the None singleton. .. attribute:: UNKNOWN_PROPERTY The type of the None singleton.