1
0
mirror of synced 2026-10-26 02:06:10 +08:00

改进错误处理:避免异常被静默吞掉

- 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:
Binary Wang
2026-07-31 04:01:57 +00:00
parent 6014c833bc
commit 0c7b6713a8
13 changed files with 78 additions and 39 deletions

View File

@@ -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);
}
}
}