熔断返回信息封装

yun-zuoyi
alwaysfrin 6 years ago
parent 87aa6644fd
commit 1371f94838

@ -18,22 +18,44 @@ public class BaseFallBackBean {
// LOGGER.error("【微服出错,熔断】{}",cause.getCause());
// cause.printStackTrace();
/**
*
* @param cause
* @return
*/
public BaseResultBean makeBaseFallBack(Throwable cause){
LOGGER.error("【熔断信息】{}", cause.getMessage());
LOGGER.error("【熔断原因】{}", cause.getCause());
cause.printStackTrace();
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。", cause);
}
/**
*
* @param msg
* @param cause
* @return
*/
public BaseResultBean makeBaseFallBack(String msg, Throwable cause){
LOGGER.error("【熔断信息】{}", cause.getMessage());
LOGGER.error("【熔断原因】{}", cause.getCause());
cause.printStackTrace();
return BaseResultBean.buildBaseResultBean(false, cause.getMessage() + ",信息:" + msg);
}
/**
*
* @return
*/
public BaseResultBean makeBaseFallBack(){
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。");
}
/**
*
* @param msg
* @return
*/
public BaseResultBean makeBaseFallBack(String msg){
return BaseResultBean.buildBaseResultBean(false, msg);
}

Loading…
Cancel
Save