I have an API server for an Android app.
I am trying to use Retrofit for this.
Api server can return normal, say /users
{ "userId":"123", "username":"John Doe" }
but it can also return an error.
{ "errorCode":0, "errorMessage":"blah" }
So I'm just wondering if there is a way to handle errors globally for each method in Retrofit?
Edit:
I ended up with a server modification.
{ data:[], error:{} }
source share