zhou-you / RxEasyHttp

本库是一款基于RxJava2+Retrofit2实现简单易用的网络请求框架,结合android平台特性的网络封装库,采用api链式调用一点到底,集成cookie管理,多种缓存模式,极简https配置,上传下载进度显示,请求错误自动重试,请求携带token、时间戳、签名sign动态配置,自动登录成功后请求重发功能,3种层次的参数设置默认全局局部,默认标准ApiResult同时可以支持自定义的数据结构,已经能满足现在的大部分网络请求。
Apache License 2.0
3.13k stars 615 forks source link

此库对错误提示未做英语语言适配 #229

Open Jooyer opened 4 years ago

Jooyer commented 4 years ago

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走国外市场,此时直接提示此错误,发现是中文,对用户不是很友好,希望大佬处理下!

zhumj commented 3 years ago

234