From 00421c4e6fc1c431a9895f04beede02795bf1093 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Thu, 15 Dec 2016 15:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java index 734593d4e..a2bd36591 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java @@ -538,7 +538,9 @@ public class WxCpServiceImpl implements WxCpService { int retryTimes = 0; do { try { - return executeInternal(executor, uri, data); + T result = this.executeInternal(executor, uri, data); + this.log.debug("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}",uri, data, result); + return result; } catch (WxErrorException e) { if (retryTimes + 1 > this.maxRetryTimes) { this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes); @@ -578,8 +580,7 @@ public class WxCpServiceImpl implements WxCpService { uriWithAccessToken += uri.indexOf('?') == -1 ? "?access_token=" + accessToken : "&access_token=" + accessToken; try { - return executor.execute(getHttpclient(), this.httpProxy, - uriWithAccessToken, data); + return executor.execute(getHttpclient(), this.httpProxy, uriWithAccessToken, data); } catch (WxErrorException e) { WxError error = e.getError(); /* @@ -592,11 +593,14 @@ public class WxCpServiceImpl implements WxCpService { this.configStorage.expireAccessToken(); return execute(executor, uri, data); } + if (error.getErrorCode() != 0) { + this.log.error("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}", uri, data, error); throw new WxErrorException(error); } return null; } catch (IOException e) { + this.log.error("\n[URL]: {}\n[PARAMS]: {}\n[EXCEPTION]: {}", uri, data, e.getMessage()); throw new RuntimeException(e); } }