de/sdk/common/src/main/java/io/dataease/exception/DEException.java
2023-10-23 22:00:14 +08:00

45 lines
1014 B
Java

package io.dataease.exception;
import io.dataease.result.ResultCode;
import lombok.Data;
@Data
public class DEException extends RuntimeException {
private int code;
private String msg;
public DEException(int code, String msg) {
super(msg);
this.code = code;
this.msg = msg;
}
private DEException(String message) {
this(ResultCode.SYSTEM_INNER_ERROR.code(), message);
}
private DEException(Throwable t) {
super(t);
this.code = ResultCode.SYSTEM_INNER_ERROR.code();
this.msg = t.getMessage();
}
public static void throwException(String message) {
throw new DEException(message);
}
public static void throwException(int code, String message) {
throw new DEException(code, message);
}
public static DEException getException(String message) {
throw new DEException(message);
}
public static void throwException(Throwable t) {
throw new DEException(t);
}
}