|
@@ -17,6 +17,7 @@ import me.chanjar.weixin.common.enums.TicketType;
|
|
|
import me.chanjar.weixin.common.enums.WxType;
|
|
|
import me.chanjar.weixin.common.error.WxError;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
+import me.chanjar.weixin.common.error.WxRuntimeException;
|
|
|
import me.chanjar.weixin.common.session.StandardSessionManager;
|
|
|
import me.chanjar.weixin.common.session.WxSessionManager;
|
|
|
import me.chanjar.weixin.common.util.DataUtils;
|
|
@@ -28,9 +29,7 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
|
|
|
import me.chanjar.weixin.mp.api.*;
|
|
|
import me.chanjar.weixin.mp.bean.WxMpSemanticQuery;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpCurrentAutoReplyInfo;
|
|
|
-import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
|
|
|
-import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
|
|
|
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
|
|
|
import me.chanjar.weixin.mp.util.WxMpConfigStorageHolder;
|
|
@@ -203,9 +202,8 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
@Override
|
|
|
public String shortUrl(String longUrl) throws WxErrorException {
|
|
|
if (longUrl.contains("&access_token=")) {
|
|
|
- throw new WxErrorException(WxError.builder().errorCode(-1)
|
|
|
- .errorMsg("要转换的网址中存在非法字符{&access_token=},会导致微信接口报错,属于微信bug,请调整地址,否则不建议使用此方法!")
|
|
|
- .build());
|
|
|
+ throw new WxErrorException("要转换的网址中存在非法字符{&access_token=}," +
|
|
|
+ "会导致微信接口报错,属于微信bug,请调整地址,否则不建议使用此方法!");
|
|
|
}
|
|
|
|
|
|
JsonObject o = new JsonObject();
|
|
@@ -303,7 +301,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
if (retryTimes + 1 > this.maxRetryTimes) {
|
|
|
log.warn("重试达到最大次数【{}】", maxRetryTimes);
|
|
|
//最后一次重试失败后,直接抛出异常,不再等待
|
|
|
- throw new RuntimeException("微信服务端异常,超出重试次数");
|
|
|
+ throw new WxRuntimeException("微信服务端异常,超出重试次数");
|
|
|
}
|
|
|
|
|
|
WxError error = e.getError();
|
|
@@ -314,7 +312,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
log.warn("微信系统繁忙,{} ms 后重试(第{}次)", sleepMillis, retryTimes + 1);
|
|
|
Thread.sleep(sleepMillis);
|
|
|
} catch (InterruptedException e1) {
|
|
|
- throw new RuntimeException(e1);
|
|
|
+ throw new WxRuntimeException(e1);
|
|
|
}
|
|
|
} else {
|
|
|
throw e;
|
|
@@ -323,7 +321,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
} while (retryTimes++ < this.maxRetryTimes);
|
|
|
|
|
|
log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
|
|
|
- throw new RuntimeException("微信服务端异常,超出重试次数");
|
|
|
+ throw new WxRuntimeException("微信服务端异常,超出重试次数");
|
|
|
}
|
|
|
|
|
|
protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException {
|
|
@@ -448,7 +446,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- throw new RuntimeException(String.format("无法找到对应【%s】的公众号配置信息,请核实!", mpId));
|
|
|
+ throw new WxRuntimeException(String.format("无法找到对应【%s】的公众号配置信息,请核实!", mpId));
|
|
|
}
|
|
|
|
|
|
@Override
|