改进错误处理:避免异常被静默吞掉
- FileUtils.imageToBase64ByStream 读取失败时抛出 WxRuntimeException,不再 printStackTrace 后返回 null - AesUtils.HMACSHA256 签名计算失败时抛出 WxRuntimeException,不再返回 null 导致签名为空 - RequestUtils.readData 读取回调请求体失败时抛出异常,不再静默返回不完整内容 - PartnerTransferServiceImpl.spDayEndBalance 传播查询异常,不再返回 null - WxMpMemberCardServiceImpl.getActivatePluginParam 解析失败时抛出 WxErrorException - DefaultApacheHttpClientBuilder 空闲连接监控线程被中断时恢复中断标志 - 支付回调转换器、临时二维码文件删除、payBaseUrl 解析失败改为记录日志 新增 FileUtilsTest、AesUtilsTest 回归测试 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.http.BaseMediaDownloadRequestExecutor;
|
||||
@@ -29,6 +30,7 @@ import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Code.*;
|
||||
* @author <a href="https://github.com/charmingoh">Charming</a>
|
||||
* @since 2018-04-26 20:00
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
private final WxMaService service;
|
||||
@@ -60,7 +62,8 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
try {
|
||||
// 及时删除二维码文件,避免积压过多缓存文件
|
||||
Files.delete(qrCodeFilePath);
|
||||
} catch (Exception ignored) {
|
||||
} catch (Exception e) {
|
||||
log.warn("删除临时二维码文件失败,path={}", qrCodeFilePath, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user