Skip to content

Commit

Permalink
Export map_exception_to_dbus_error and document it
Browse files Browse the repository at this point in the history
  • Loading branch information
igo95862 committed Jun 13, 2022
1 parent bafd7f6 commit 0b107e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ If ``dbus_error_name`` is not unique the :py:exc:`ValueError` will be raised.
Defining an exception will automatically bind incoming error message to this
new exception.

Existing exceptions can be manually binded using :py:func:`map_exception_to_dbus_error`
function.

Functions
+++++++++

.. py:function:: map_exception_to_dbus_error(exception, dbus_error_name)
Map exception to a D-bus error. Error name must be unique.

:param Type[Exception] exception: Exception to bind.
:param str dbus_error_name: D-Bus error name to bind to.


Other exceptions
+++++++++++++++++++++++++

Expand Down
2 changes: 2 additions & 0 deletions src/sdbus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
SdBusUnmappedMessageError,
decode_object_path,
encode_object_path,
map_exception_to_dbus_error,
sd_bus_open,
sd_bus_open_system,
sd_bus_open_system_machine,
Expand Down Expand Up @@ -158,6 +159,7 @@
'SdBusUnmappedMessageError',
'decode_object_path',
'encode_object_path',
'map_exception_to_dbus_error',
'sd_bus_open',
'sd_bus_open_system',
'sd_bus_open_system_machine',
Expand Down

0 comments on commit 0b107e0

Please sign in to comment.