mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-28 04:29:07 +08:00
🎨 #1189 优化错误异常输出,移除冗余代码
This commit is contained in:
@ -1,10 +1,6 @@
|
||||
package me.chanjar.weixin.open.api.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import me.chanjar.weixin.common.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
@ -12,6 +8,10 @@ import me.chanjar.weixin.common.util.http.RequestHttp;
|
||||
import me.chanjar.weixin.open.api.WxOpenComponentService;
|
||||
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
|
||||
import me.chanjar.weixin.open.api.WxOpenService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
@ -44,7 +44,7 @@ public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService,
|
||||
|
||||
protected synchronized <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException {
|
||||
try {
|
||||
T result = executor.execute(uri, data);
|
||||
T result = executor.execute(uri, data, WxType.Open);
|
||||
this.log.debug("\n【请求地址】: {}\n【请求参数】:{}\n【响应数据】:{}", uri, data, result);
|
||||
return result;
|
||||
} catch (WxErrorException e) {
|
||||
|
||||
@ -33,7 +33,7 @@ public class MaQrCodeApacheHttpRequestExecutor extends MaQrCodeRequestExecutor<C
|
||||
}
|
||||
|
||||
@Override
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam) throws WxErrorException, IOException {
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam, WxType wxType) throws WxErrorException, IOException {
|
||||
if (qrcodeParam != null && StringUtils.isNotBlank(qrcodeParam.getPagePath())) {
|
||||
if (uri.indexOf('?') == -1) {
|
||||
uri += '?';
|
||||
|
||||
@ -31,7 +31,7 @@ public class MaQrCodeJoddHttpRequestExecutor extends MaQrCodeRequestExecutor<Htt
|
||||
}
|
||||
|
||||
@Override
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam) throws WxErrorException, IOException {
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam, WxType wxType) throws WxErrorException, IOException {
|
||||
if (qrcodeParam != null && StringUtils.isNotBlank(qrcodeParam.getPagePath())) {
|
||||
if (uri.indexOf('?') == -1) {
|
||||
uri += '?';
|
||||
|
||||
@ -32,7 +32,7 @@ public class MaQrCodeOkhttpRequestExecutor extends MaQrCodeRequestExecutor<OkHtt
|
||||
}
|
||||
|
||||
@Override
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam) throws WxErrorException, IOException {
|
||||
public File execute(String uri, WxMaQrcodeParam qrcodeParam, WxType wxType) throws WxErrorException, IOException {
|
||||
if (qrcodeParam != null && StringUtils.isNotBlank(qrcodeParam.getPagePath())) {
|
||||
if (uri.indexOf('?') == -1) {
|
||||
uri += '?';
|
||||
|
||||
@ -3,6 +3,7 @@ package me.chanjar.weixin.open.util.requestexecuter.ma;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import me.chanjar.weixin.common.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
@ -24,8 +25,8 @@ public abstract class MaQrCodeRequestExecutor<H, P> implements RequestExecutor<F
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String uri, WxMaQrcodeParam data, ResponseHandler<File> handler) throws WxErrorException, IOException {
|
||||
handler.handle(this.execute(uri, data));
|
||||
public void execute(String uri, WxMaQrcodeParam data, ResponseHandler<File> handler, WxType wxType) throws WxErrorException, IOException {
|
||||
handler.handle(this.execute(uri, data, wxType));
|
||||
}
|
||||
|
||||
public static RequestExecutor<File, WxMaQrcodeParam> create(RequestHttp requestHttp) throws WxErrorException {
|
||||
|
||||
Reference in New Issue
Block a user