io.github.dengchen2020.core.exception.CallException Maven / Gradle / Ivy
package io.github.dengchen2020.core.exception;
import org.slf4j.helpers.MessageFormatter;
/**
* 调用异常-接口未按照规定的方式调用产生的异常
* 调用异常如果没有数据返回,推荐直接使用该类
*
* @author dengchen
* @since 2019/10/17 11:03
*/
public class CallException extends BaseException {
private static final Integer CODE = 101;
/**
* 是否告警
*/
private Boolean alarm;
public Boolean getAlarm() {
return alarm;
}
public void setAlarm(Boolean alarm) {
this.alarm = alarm;
}
//直接实例化构造方法
public CallException(String message, Throwable cause) {
super(message, cause, CODE);
this.alarm = true;
}
public CallException(String message) {
this(message, (Throwable) null);
this.alarm = true;
}
public CallException(String message,Boolean alarm) {
this(message, (Throwable) null);
this.alarm = alarm;
}
public CallException(String message,Object... args) {
super(MessageFormatter.arrayFormat(message,args).getMessage(), CODE);
this.alarm = true;
}
public CallException(String message,Boolean alarm,Object... args) {
super(MessageFormatter.format(message,args).getMessage(), CODE);
this.alarm = alarm;
}
//子类继承构造方法
protected CallException(String message, Throwable cause, Integer code) {
super(message, cause, code);
this.alarm = false;
}
protected CallException(String message, Integer code) {
this(message, null, code);
this.alarm = false;
}
}