GitHub user prestona opened a pull request:
https://github.com/apache/qpid-proton/pull/37
PROTON-881: Graceful handling of runtime exceptions thrown within hanâ¦
â¦dlers
When a runtime (unchecked) exceptions is thrown within a handler, the
reactor now catches it and rethrows it as a HandlerException (which is also an
unchecked exception). The HandlerException references the handler that threw
the original exception and also chains the original exception as its "cause".
Note: this PR makes a (slight) change in behaviour to the Event.dispatch()
method. Currently if an application throws an unchecked exception from within
the dispatch() method, this exception will peculate up the stack until it is
caught. With this PR: any unchecked exceptions thrown by a handler will be
trapped inside the dispatch() method and re-thrown linked to a
HandlerException. I /think/ that this is unlikely to break (m)any applications
- as relying on exact runtime behaviour when throwing unchecked exceptions from
callbacks is a rather risky thing to do...
However: if this is a problem I can move the code for trapping unchecked
exceptions out of the EventImpl class. The disadvantage to doing this is that
it will no longer be possible to identify the specific handler that threw the
exception.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/prestona/qpid-proton reactor
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/qpid-proton/pull/37.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #37
----
commit f9f46900b606c103cc6be48e892370896cfbae1e
Author: Adrian Preston <[email protected]>
Date: 2015-06-15T21:49:43Z
PROTON-881: Graceful handling of runtime exceptions thrown within handlers
When a runtime (unchecked) exception is thrown from within a handler, the
reactor now catches it and rethrows it as a HandlerException (which is
also an unchecked exception). The HandlerException references the handler
that threw the original exception and also chains the original exception
as its "cause".
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---