|
|
|
@ -18,23 +18,45 @@ 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());
|
|
|
|
|
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。",cause);
|
|
|
|
|
LOGGER.error("【熔断信息】{}", cause.getMessage());
|
|
|
|
|
LOGGER.error("【熔断原因】{}", cause.getCause());
|
|
|
|
|
cause.printStackTrace();
|
|
|
|
|
return makeBaseFallBack("【微服熔断】服务暂停,请稍后再试。", cause);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BaseResultBean makeBaseFallBack(String msg,Throwable cause){
|
|
|
|
|
LOGGER.error("【熔断信息】{}",cause.getMessage());
|
|
|
|
|
LOGGER.error("【熔断原因】{}",cause.getCause());
|
|
|
|
|
return BaseResultBean.buildBaseResultBean(false,cause.getMessage() + ",信息:" + msg);
|
|
|
|
|
/**
|
|
|
|
|
* 自定义熔断信息封装方法
|
|
|
|
|
* @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);
|
|
|
|
|
return BaseResultBean.buildBaseResultBean(false, msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|