You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
Java
56 lines
1.2 KiB
Java
package com.supervision.exception;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
public class ItemNotFoundException extends RuntimeException {
|
|
|
|
/**
|
|
* 异常编码
|
|
*/
|
|
private final Integer code;
|
|
|
|
/**
|
|
* 异常信息
|
|
*/
|
|
private final String message;
|
|
|
|
public ItemNotFoundException(Throwable cause) {
|
|
super(cause);
|
|
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
|
this.message = null;
|
|
|
|
}
|
|
|
|
public ItemNotFoundException(Throwable cause, String message) {
|
|
super(cause);
|
|
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
|
this.message = message;
|
|
|
|
}
|
|
|
|
public ItemNotFoundException(String message) {
|
|
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
|
this.message = message;
|
|
}
|
|
|
|
public ItemNotFoundException(String message, Integer code) {
|
|
this.message = message;
|
|
this.code = code;
|
|
}
|
|
|
|
public ItemNotFoundException(String message, Throwable e) {
|
|
super(message, e);
|
|
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
|
|
this.message = message;
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return message;
|
|
}
|
|
|
|
public Integer getCode() {
|
|
return code;
|
|
}
|
|
}
|