Reputation: 23268
I want to take different actions when volley time outs or has a network problem (vs when there is a problem on the server).
As I understand both cases will be reported by volley through the same ErrorListener interface.
I have a code currently which parses the message in VolleyError and check for couple of things (search following strings) to determine whether it was timeout/network problem (vs a server error).
However, I am not that happy with this code. First of all, it's hacky. Also, I can easily miss some cases which I am not aware of.
I am wondering whether there is a better way to distinguish these two groups of errors?
Upvotes: 0
Views: 407
Reputation: 23268
Oh... I didn't realize there are subclasses, which implement some of Volley errors:
So, instead of checking message, I should be checking a class of an error.
Upvotes: 1