Fabian Zeindl Fabian Zeindl - 5 months ago 54
Java Question

Guava EventBus: don't catch RuntimeException

I use guava's EventBus, unfortunately it catches and logs the InvocationTargetException that occurs when an event-handler throws a RuntimeException. Can i disable this behaviour?


As it stands, this is a deliberate decision, and discussed in the EventBus docs:

Handlers should not, in general, throw. If they do, the EventBus will catch and log the exception. This is rarely the right solution for error handling and should not be relied upon; it is intended solely to help find problems during development.

Alternative solutions are being considered, though I seriously doubt they'll make it into release 12.