![JAR search and dependency download from the Maven repository](/logo.png)
cn.zhxu.bp.RespException Maven / Gradle / Ivy
package cn.zhxu.bp;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public class RespException extends RuntimeException {
private final HttpStatus status;
public RespException(HttpStatus status) {
this.status = status;
}
public RespException(HttpStatus status, String msg) {
super(msg);
this.status = status;
}
public static RespException badRequest(String msg) {
return new RespException(HttpStatus.BAD_REQUEST, msg);
}
public static RespException unauthorized(String msg) {
return new RespException(HttpStatus.UNAUTHORIZED, msg);
}
public static RespException forbidden(String msg) {
return new RespException(HttpStatus.FORBIDDEN, msg);
}
public static RespException notFound(String msg) {
return new RespException(HttpStatus.NOT_FOUND, msg);
}
public static RespException noContent() {
return new RespException(HttpStatus.NO_CONTENT);
}
public static RespException serverError(String msg) {
return new RespException(HttpStatus.INTERNAL_SERVER_ERROR, msg);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy