com.zhouyou.http.exception.ApiException
if (e instanceof JsonParseException
|| e instanceof JSONException
|| e instanceof JsonSyntaxException
|| e instanceof JsonSerializer
|| e instanceof NotSerializableException
|| e instanceof ParseException) {
ex = new ApiException(e, ERROR.PARSE_ERROR);
ex.message = "解析错误";
return ex;
} else if (e instanceof ClassCastException) {
ex = new ApiException(e, ERROR.CAST_ERROR);
ex.message = "类型转换错误";
return ex;
} else if (e instanceof ConnectException) {
ex = new ApiException(e, ERROR.NETWORD_ERROR);
ex.message = "连接失败";
return ex;
} else if (e instanceof javax.net.ssl.SSLHandshakeException) {
ex = new ApiException(e, ERROR.SSL_ERROR);
ex.message = "证书验证失败";
return ex;
} else if (e instanceof ConnectTimeoutException) {
ex = new ApiException(e, ERROR.TIMEOUT_ERROR);
ex.message = "连接超时";
return ex;
} else if (e instanceof java.net.SocketTimeoutException) {
ex = new ApiException(e, ERROR.TIMEOUT_ERROR);
ex.message = "连接超时";
return ex;
} else if (e instanceof UnknownHostException) {
ex = new ApiException(e, ERROR.UNKNOWNHOST_ERROR);
ex.message = "无法解析该域名";
return ex;
} else if (e instanceof NullPointerException) {
ex = new ApiException(e, ERROR.NULLPOINTER_EXCEPTION);
ex.message = "NullPointerException";
return ex;
} else {
ex = new ApiException(e, ERROR.UNKNOWN);
ex.message = "未知错误";
return ex;
}
我们的APP走国外市场,此时直接提示此错误,发现是中文,对用户不是很友好,希望大佬处理下!
com.zhouyou.http.exception.ApiException if (e instanceof JsonParseException || e instanceof JSONException || e instanceof JsonSyntaxException || e instanceof JsonSerializer || e instanceof NotSerializableException || e instanceof ParseException) { ex = new ApiException(e, ERROR.PARSE_ERROR); ex.message = "解析错误"; return ex; } else if (e instanceof ClassCastException) { ex = new ApiException(e, ERROR.CAST_ERROR); ex.message = "类型转换错误"; return ex; } else if (e instanceof ConnectException) { ex = new ApiException(e, ERROR.NETWORD_ERROR); ex.message = "连接失败"; return ex; } else if (e instanceof javax.net.ssl.SSLHandshakeException) { ex = new ApiException(e, ERROR.SSL_ERROR); ex.message = "证书验证失败"; return ex; } else if (e instanceof ConnectTimeoutException) { ex = new ApiException(e, ERROR.TIMEOUT_ERROR); ex.message = "连接超时"; return ex; } else if (e instanceof java.net.SocketTimeoutException) { ex = new ApiException(e, ERROR.TIMEOUT_ERROR); ex.message = "连接超时"; return ex; } else if (e instanceof UnknownHostException) { ex = new ApiException(e, ERROR.UNKNOWNHOST_ERROR); ex.message = "无法解析该域名"; return ex; } else if (e instanceof NullPointerException) { ex = new ApiException(e, ERROR.NULLPOINTER_EXCEPTION); ex.message = "NullPointerException"; return ex; } else { ex = new ApiException(e, ERROR.UNKNOWN); ex.message = "未知错误"; return ex; } 我们的APP走国外市场,此时直接提示此错误,发现是中文,对用户不是很友好,希望大佬处理下!