Skip to content

Commit e332d57

Browse files
committed
refactor: 添加 SimpleException 构造方法,传入 ErrorEnum 默认使用 reason 作为 message
1 parent 7896086 commit e332d57

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/top/cadecode/simple/common/exception/SimpleException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public class SimpleException extends RuntimeException {
1515

1616
private final ErrorEnum errorEnum;
1717

18+
public SimpleException(ErrorEnum errorEnum) {
19+
super(errorEnum.getReason());
20+
this.errorEnum = errorEnum;
21+
}
22+
1823
public SimpleException(ErrorEnum errorEnum, String message) {
1924
super(message);
2025
this.errorEnum = errorEnum;

0 commit comments

Comments
 (0)