refactor: 服务调用出错时记录相关调用信息到日志中

This commit is contained in:
shiziyuan9527 2023-03-27 10:32:57 +08:00 committed by lyh
parent 02326e79d5
commit 17581ff415
1 changed files with 2 additions and 2 deletions

View File

@ -180,12 +180,12 @@ public class MicroService {
ResponseEntity<ResultHolder> entity = restTemplate.exchange(chooseService(serviceId, url), HttpMethod.POST, httpEntity, ResultHolder.class);
return entity.getBody();
} catch (Exception e) {
String massage = "服务调用出错[serviceId:" + serviceId + ",url:" + url + "],错误信息:" + e.getMessage();
LogUtil.error(massage, e);
if (e instanceof HttpServerErrorException) {
this.handleHttpServerErrorException((HttpServerErrorException) e);
return null;
}
String massage = "服务调用出错[serviceId:" + serviceId + ",url:" + url + "],错误信息:" + e.getMessage();
LogUtil.error(massage, e);
MSException.throwException(massage);
}
return null;