refactor: 服务调用出错时记录相关调用信息到日志中
This commit is contained in:
parent
02326e79d5
commit
17581ff415
|
@ -180,12 +180,12 @@ public class MicroService {
|
||||||
ResponseEntity<ResultHolder> entity = restTemplate.exchange(chooseService(serviceId, url), HttpMethod.POST, httpEntity, ResultHolder.class);
|
ResponseEntity<ResultHolder> entity = restTemplate.exchange(chooseService(serviceId, url), HttpMethod.POST, httpEntity, ResultHolder.class);
|
||||||
return entity.getBody();
|
return entity.getBody();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
String massage = "服务调用出错[serviceId:" + serviceId + ",url:" + url + "],错误信息:" + e.getMessage();
|
||||||
|
LogUtil.error(massage, e);
|
||||||
if (e instanceof HttpServerErrorException) {
|
if (e instanceof HttpServerErrorException) {
|
||||||
this.handleHttpServerErrorException((HttpServerErrorException) e);
|
this.handleHttpServerErrorException((HttpServerErrorException) e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String massage = "服务调用出错[serviceId:" + serviceId + ",url:" + url + "],错误信息:" + e.getMessage();
|
|
||||||
LogUtil.error(massage, e);
|
|
||||||
MSException.throwException(massage);
|
MSException.throwException(massage);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue