作者 王勇

为自定义的异常,添加一个构造方法,为日后所需做铺垫

@@ -23,6 +23,11 @@ public class CustomException extends RuntimeException { @@ -23,6 +23,11 @@ public class CustomException extends RuntimeException {
23 this.message = message; 23 this.message = message;
24 } 24 }
25 25
  26 + public CustomException(CustomExceptionType exceptionTypeEnum) {
  27 + this.code = exceptionTypeEnum.getCode();
  28 + this.message = exceptionTypeEnum.getMsg();
  29 + }
  30 +
26 public String getCode() { 31 public String getCode() {
27 return code; 32 return code;
28 } 33 }