Skip to content

Commit c9823c4

Browse files
committed
server exception message
1 parent be04a10 commit c9823c4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rxretrohttp/src/main/java/com/bakerj/rxretrohttp/exception/ApiException.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.bakerj.rxretrohttp.exception;
22

3-
import com.bakerj.rxretrohttp.RxRetroHttp;
3+
import android.text.TextUtils;
4+
45
import com.bakerj.rxretrohttp.bean.IApiResult;
56

67
import org.apache.http.conn.ConnectTimeoutException;
@@ -66,8 +67,10 @@ public static ApiException handleException(Throwable e, String defaultErrMsg) {
6667
} else if (e instanceof ServerException) {
6768
ServerException resultException = (ServerException) e;
6869
ex = new ApiException(resultException, resultException.getCode());
69-
// ex.message = resultException.getMessage();
70-
ex.message = defaultErrMsg;
70+
ex.message = resultException.getMessage();
71+
if (TextUtils.isEmpty(ex.message)) {
72+
ex.message = defaultErrMsg;
73+
}
7174
return ex;
7275
} else if (e instanceof ConnectException) {
7376
ex = new ApiException(e, NETWORK_ERROR);

0 commit comments

Comments
 (0)