Skip to content

Commit 82e67cc

Browse files
committed
documentation for methodcall error handler
1 parent f1b0441 commit 82e67cc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

docs/source/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Change Log
77
- reworked the timezones example. (it didn't work as intended)
88
- httpgateway message data bytearray type fix
99
- fixed ipv6 error in filetransfer example
10-
10+
- added methodcall_error_handler in documentation
1111

1212

1313
**Pyro 5.10**

docs/source/servercode.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,3 +799,19 @@ object name. You can use it directly but it is preferable to use the constant
799799
>>> daemon.registered()
800800
['Pyro.NameServer', 'Pyro.Daemon']
801801

802+
803+
Intercepting errors in user code executed in a method call
804+
----------------------------------------------------------
805+
When a method call is executed in a Pyro server/daemon, it eventually will execute some
806+
user written code that implements the remote method. This user code may raise an exception
807+
(intentionally or not). Normally, Pyro will only report the exception to the calling client.
808+
809+
It may be useful however to also process the error on the *server*, for instance, to log the error
810+
somewhere for later reference. For this purpose, you can set the ``methodcall_error_handler`` attribute
811+
on the daemon object to a custom error handler function. See the :file:`exceptions` example.
812+
This function's signature is::
813+
814+
def custom_error_handler(daemon: Daemon, client_sock: socketutil.SocketConnection,
815+
method: Callable, vargs: Sequence[Any], kwargs: Dict[str, Any],
816+
exception: Exception) -> None
817+

0 commit comments

Comments
 (0)