Skip to content

Commit 0b107e0

Browse files
committed
Export map_exception_to_dbus_error and document it
1 parent bafd7f6 commit 0b107e0

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

docs/exceptions.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ If ``dbus_error_name`` is not unique the :py:exc:`ValueError` will be raised.
3434
Defining an exception will automatically bind incoming error message to this
3535
new exception.
3636

37+
Existing exceptions can be manually binded using :py:func:`map_exception_to_dbus_error`
38+
function.
39+
40+
Functions
41+
+++++++++
42+
43+
.. py:function:: map_exception_to_dbus_error(exception, dbus_error_name)
44+
45+
Map exception to a D-bus error. Error name must be unique.
46+
47+
:param Type[Exception] exception: Exception to bind.
48+
:param str dbus_error_name: D-Bus error name to bind to.
49+
50+
3751
Other exceptions
3852
+++++++++++++++++++++++++
3953

src/sdbus/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
SdBusUnmappedMessageError,
9393
decode_object_path,
9494
encode_object_path,
95+
map_exception_to_dbus_error,
9596
sd_bus_open,
9697
sd_bus_open_system,
9798
sd_bus_open_system_machine,
@@ -158,6 +159,7 @@
158159
'SdBusUnmappedMessageError',
159160
'decode_object_path',
160161
'encode_object_path',
162+
'map_exception_to_dbus_error',
161163
'sd_bus_open',
162164
'sd_bus_open_system',
163165
'sd_bus_open_system_machine',

0 commit comments

Comments
 (0)