异常处理问题记录


联调功能的时候,执行到业务处理逻辑开始后就没有下文了,剩下的逻辑没打日志了 image.png

看代码,按道理是要继续下面的逻辑,返回的就是SUCCESS

LOGGER.info("订单号:[{}]业务处理逻辑开始",merchantOrderNo);
			if("SUCCESS".equals(tradeStatus)){//支付成功
				LOGGER.info("MessageId[{}]:调用memberBaseInfoService.getMemberDetailBySellerId方法开始,入参[{}]",messageId,sellerInfo.getResult().getId());
				ExecuteResult<MemberDetailInfo> MemberDetailInfo = memberBaseInfoService.getMemberDetailBySellerId(sellerInfo.getResult().getId());
				LOGGER.info("MessageId[{}]:调用memberBaseInfoService.getMemberDetailById方法开始,出参:[{}]",messageId,JSON.toJSONString(MemberDetailInfo));
				OrderQueryParamReqDTO orderQuery = new OrderQueryParamReqDTO();

看了很久没看出问题,最后仔细看打印的日志,发现加重字体部分,没有返回数据,

,入参["200427105559041001249"] 2020-10-27 17:56:00.209|[TID: N/A]|http-bio-8080-exec-9|||INFO|SubmitController|MessageId[16037925600191670618534]:**调用memberCallCenterService.selectSellerInfoByAccountNo方法开始,出参[{"errorMessages":["error"],"success":false}]** 2020-10-27 17:56:00.209|[TID: N/A]|http-bio-8080-exec-9|||INFO|SubmitController|订单号:[1020102717122512866]签名成功

而下面这段代码是要获取 memberCallCenterService.selectSellerInfoByAccountNo方法获取的数据做为入参,来打印日志,这样肯定抛异常了。

LOGGER.info("MessageId[{}]:调用 memberBaseInfoService.getMemberDetailBySellerId方法开始,入参[{}]",messageId,sellerInfo.getResult().getId());

而代码里为啥没有异常日志,而是这个方法直接抛到页面了,而这是回调,也没啥页面,写法严重有问题

public void notify(OrderDmo orderDmo, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception {

异常处理及日志一定要有!

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×