[xSocket-develop] AbstractEndpoint.HandlerProcessor eats Exceptions
Status: Inactive
Brought to you by:
grro
|
From: gk <gk...@ph...> - 2008-11-28 10:18:47
|
Hi.. I ran across the following Problem in case a uncaught Exception is thrown in a IDatagramHandler, like a RuntimeException, it is very very hard to detect. The usual way we handle this kind of Exceptions is to register a default UncaughtExceptionHandler on the Thread class. It contains logic to deal with the Exception and report them accordingly. Now in case IDatagramHandler throws such a Exception it is catched and eaten by run() in AbstractEndpoint.HandlerProcessor. As far as I know it is not recommended to silently catch away exceptions, specially for a API used by others this could lead to confusion and troubles to find errors. Everything appears to be fine even though errors occur. I would suggest/recommend to throw the caught Exception again after handling it. So that it pops up as uncaught exception on the Thread. This way xSocket API users can see error and handle the Exception accordingly. Regards, Gregor |