从"Blog"仓库中分离出来
This commit is contained in:
34
src/main/java/cn/celess/blog/exception/MyException.java
Normal file
34
src/main/java/cn/celess/blog/exception/MyException.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package cn.celess.blog.exception;
|
||||
|
||||
import cn.celess.blog.enmu.ResponseEnum;
|
||||
|
||||
/**
|
||||
* @author : xiaohai
|
||||
* @date : 2019/03/28 16:56
|
||||
*/
|
||||
public class MyException extends RuntimeException {
|
||||
private int code;
|
||||
|
||||
public MyException(int code, String msg) {
|
||||
super(msg);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public MyException(ResponseEnum e) {
|
||||
super(e.getMsg());
|
||||
this.code = e.getCode();
|
||||
}
|
||||
|
||||
public MyException(ResponseEnum e, String msg) {
|
||||
super(msg + e.getMsg());
|
||||
this.code = e.getCode();
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user