| | |
| | | import com.example.jz.enums.BusinessHttpStatus; |
| | | import org.springframework.http.HttpStatus; |
| | | |
| | | public class BusinessException extends RuntimeException{ |
| | | public class BusinessException extends RuntimeException { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = -4137688758944857209L; |
| | | |
| | | /** |
| | | * http状态码 |
| | | */ |
| | | private Integer httpStatusCode; |
| | | |
| | | |
| | | /** |
| | | * @param httpStatus http状态码 |
| | |
| | | this.httpStatusCode = httpStatus.value(); |
| | | } |
| | | |
| | | |
| | | public BusinessException(String msg) { |
| | | super(msg); |
| | | this.httpStatusCode = HttpStatus.BAD_REQUEST.value(); |
| | | this.httpStatusCode = BusinessHttpStatus.BAD_EXCEPTION.value(); |
| | | } |
| | | |
| | | |
| | | public Integer getHttpStatusCode() { |
| | | return httpStatusCode; |
| | | } |
| | | |
| | | } |
| | | } |