I’ve got a callback with exception instance. Currently i handle it this way, but i think that there is a better way. Would like to hear some comment from Java expert. =)
...
onError(Exception e) {
if (e instanceof IOException) {
ioe = (IOException)e;
// do smth with ioe
} else if (e instanceof MyException) {
mye = (MyException)e;
// do smth with mye
}
}
...
I’m not 100% sure about what you mean by “handle exceptions inside callback”, but the
onErrormethod you provided could be better expressed like this: