Skip to content

Commit

Permalink
server exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
BakerJQ committed Apr 18, 2019
1 parent be04a10 commit c9823c4
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bakerj.rxretrohttp.exception;

import com.bakerj.rxretrohttp.RxRetroHttp;
import android.text.TextUtils;

import com.bakerj.rxretrohttp.bean.IApiResult;

import org.apache.http.conn.ConnectTimeoutException;
Expand Down Expand Up @@ -66,8 +67,10 @@ public static ApiException handleException(Throwable e, String defaultErrMsg) {
} else if (e instanceof ServerException) {
ServerException resultException = (ServerException) e;
ex = new ApiException(resultException, resultException.getCode());
// ex.message = resultException.getMessage();
ex.message = defaultErrMsg;
ex.message = resultException.getMessage();
if (TextUtils.isEmpty(ex.message)) {
ex.message = defaultErrMsg;
}
return ex;
} else if (e instanceof ConnectException) {
ex = new ApiException(e, NETWORK_ERROR);
Expand Down

0 comments on commit c9823c4

Please # to comment.