I would like to get a second opinion on how to handle Exceptions within "events" (key input, screen update etc). In this case I have control over the event-sender.
So a module is set to handle an event (it implements a listener interface, and is registered against an event sender):
public void DefaultSet ( CardData oldDefault, CardData newDefault )
{
}
The event sender is simply:
for ( Enumeration e = listeners.elements(); e.hasMoreElements(); )
{
RetrieverListener thisListener = (RetrieverListener) e.nextElement();
thisListener.DefaultSet( oldDefault, newDefault );
}
So if/when something goes wrong in the receiver:
Should I try to cope with the exception there, and never throw anything back to the sender? Sometimes the listeners don't have the "context" to handle an error correctly, is that right?
Is it frowned on to throw an exception back to an event-sending module, to be handled in a documented way? e.g. "Throwing an IOException will result in a reset.. ". This seems non-standard from the javadocs I have read.
Should I just log and ignore the exception when something goes wrong & nothing can be done about it?