parent
d087182825
commit
6bb2dd273e
@ -0,0 +1,21 @@
|
||||
package com.hzu.bookingsystem.exception;
|
||||
|
||||
import com.hzu.bookingsystem.VO.ResultVO;
|
||||
import com.hzu.bookingsystem.utils.ResultVOUtil;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
/**
|
||||
* author 吴志岳
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(value = UserAuthorizeException.class)
|
||||
@ResponseBody
|
||||
public ResultVO handlerAuthorizeException(HttpServletRequest servletRequest,Exception e) {
|
||||
return ResultVOUtil.error(403,e.getMessage());
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.hzu.bookingsystem.exception;
|
||||
|
||||
/**
|
||||
* author 吴志岳
|
||||
*/
|
||||
public class UserAuthorizeException extends RuntimeException {
|
||||
public UserAuthorizeException(){
|
||||
|
||||
}
|
||||
public UserAuthorizeException(String message){
|
||||
super(message);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue