I am using Retrofit2 with RxJava. So my call looks something like
subscriptions.add(authenticateUser(mReq, refreshRequest)
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(authResponseModel -> {
processResponse(authResponseModel, userName, encryptedPass);
}, throwable ->
{
LOGW(TAG, throwable.getMessage());
}));
It's an authentication api. So when the api call fails, I get a response from the server like
{"messages":["Invalid username or password "]}
along with 400 Bad Request
I get 400 Bad Request
in the throwable
object as expected. But I want to receive the message thrown by the server. I am unable to figure out how to go about doing it.
Can someone help out.