PDA

View Full Version : [CLOSED] ListStore swallows exceptions



thatone
6 Mar 2009, 2:01 PM
We encountered a situation where a nefarious NPE in our code was being swallowed.
Took a while to figure out where. What happened was that our NPE was thrown from within the onSuccess code of an RpcProxy whose logic is to catch exceptions and pass them on to callback.onFailure().

This would be fine except that the BaseListLoader's callback.onFailure() simply fires a LoadException. If you are only using the loader with a ListStore, list store's default behaviour is to simply swallow the event:

protected void onLoadException(LoadEvent le) {
}

Code should NEVER swallow exceptions, especially by default. As an API user, i should never have to explicitly wire up a LoadException to make sure exception's are visible.

sven
6 Mar 2009, 2:18 PM
It doesnt swallow the event. It just listens to it and does nothing. You can listen to and it do your actions

thatone
6 Mar 2009, 3:00 PM
I guess my point is that it would be nice if the BaseLoader/ListStore combination was programmed more defensively. Out-of-the-box this combination should do something to let the developer know that an exception is happening. Even if it just logged the exception to the console.

It is not immediately obvious that a developer MUST implement their own exception listener to notice the exception.

sven
6 Mar 2009, 3:03 PM
That exactly is the point of that event, so that you can listen to it and handle it.