|
|
|
@ -141,7 +141,13 @@ public class ApiClient {
|
|
|
|
|
String responseJson = decryptResponse(response, isEnhanced);
|
|
|
|
|
t = MapperUtil.toJava(responseJson, request.responseClass());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
} catch (ConnectException e) {
|
|
|
|
|
t = MapperUtil.toJava("{}", request.responseClass());
|
|
|
|
|
t.addError(ErrorType.SYSTEM_ERROR, "网络异常!");
|
|
|
|
|
} catch (SocketTimeoutException e) {
|
|
|
|
|
t = MapperUtil.toJava("{}", request.responseClass());
|
|
|
|
|
t.addError(ErrorType.SYSTEM_ERROR, "请求超时!");
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
t = MapperUtil.toJava("{}", request.responseClass());
|
|
|
|
|
t.addError(ErrorType.SYSTEM_ERROR, "请求异常!");
|
|
|
|
|
} finally {
|
|
|
|
@ -200,11 +206,11 @@ public class ApiClient {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
T t = MapperUtil.toJava("{}", request.responseClass());
|
|
|
|
|
if (e instanceof ConnectException) {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "网络连接错误!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "网络异常!");
|
|
|
|
|
} else if (e instanceof SocketTimeoutException) {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "连接超时!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求超时!");
|
|
|
|
|
} else {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求错误!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求异常!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (after != null) {
|
|
|
|
@ -225,7 +231,7 @@ public class ApiClient {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
t = MapperUtil.toJava("{}", request.responseClass());
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "服务器异常!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "服务器走了下神!");
|
|
|
|
|
}
|
|
|
|
|
if (after != null) {
|
|
|
|
|
after.call(request, t);
|
|
|
|
@ -297,11 +303,11 @@ public class ApiClient {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
FileUploadResponse t = MapperUtil.toJava("{}", FileUploadResponse.class);
|
|
|
|
|
if (e instanceof ConnectException) {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "网络连接错误!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "网络异常!");
|
|
|
|
|
} else if (e instanceof SocketTimeoutException) {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "连接超时!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求超时!");
|
|
|
|
|
} else {
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求错误!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "请求异常!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (after != null) {
|
|
|
|
@ -323,7 +329,7 @@ public class ApiClient {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
t = new FileUploadResponse();
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "服务器异常!");
|
|
|
|
|
t.addError(ErrorType.BUSINESS_ERROR, "服务器走了下神!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (after != null) {
|
|
|
|
|