类 AbstractGlobalExceptionHandler

java.lang.Object
top.tangyh.basic.boot.handler.AbstractGlobalExceptionHandler

public abstract class AbstractGlobalExceptionHandler extends Object
全局异常统一处理
作者:
zuihou
  • 字段详细资料

    • profiles

      @Value("${spring.profiles.active:dev}") protected String profiles
  • 构造器详细资料

    • AbstractGlobalExceptionHandler

      public AbstractGlobalExceptionHandler()
  • 方法详细资料

    • bizException

      @ExceptionHandler(top.tangyh.basic.exception.BizException.class) @ResponseStatus(BAD_REQUEST) public R<?> bizException(BizException ex)
    • handlerSaTokenException

      @ExceptionHandler(cn.dev33.satoken.exception.SaTokenException.class) public R<?> handlerSaTokenException(cn.dev33.satoken.exception.SaTokenException e)
    • bizException

      @ResponseStatus(BAD_REQUEST) @ExceptionHandler(top.tangyh.basic.exception.ArgumentException.class) public R<?> bizException(ArgumentException ex)
    • forbiddenException

      @ExceptionHandler(top.tangyh.basic.exception.ForbiddenException.class) @ResponseStatus(FORBIDDEN) public R<?> forbiddenException(ForbiddenException ex)
    • unauthorizedException

      @ExceptionHandler(top.tangyh.basic.exception.UnauthorizedException.class) @ResponseStatus(UNAUTHORIZED) public R<?> unauthorizedException(UnauthorizedException ex)
    • httpMessageNotReadableException

      @ExceptionHandler(org.springframework.http.converter.HttpMessageNotReadableException.class) @ResponseStatus(BAD_REQUEST) public R<?> httpMessageNotReadableException(org.springframework.http.converter.HttpMessageNotReadableException ex)
    • bindException

      @ExceptionHandler(org.springframework.validation.BindException.class) @ResponseStatus(BAD_REQUEST) public R<?> bindException(org.springframework.validation.BindException ex)
    • methodArgumentTypeMismatchException

      @ExceptionHandler(org.springframework.web.method.annotation.MethodArgumentTypeMismatchException.class) @ResponseStatus(BAD_REQUEST) public R<?> methodArgumentTypeMismatchException(org.springframework.web.method.annotation.MethodArgumentTypeMismatchException ex)
    • illegalStateException

      @ExceptionHandler(java.lang.IllegalStateException.class) @ResponseStatus(BAD_REQUEST) public R<?> illegalStateException(IllegalStateException ex)
    • missingServletRequestParameterException

      @ExceptionHandler(org.springframework.web.bind.MissingServletRequestParameterException.class) @ResponseStatus(BAD_REQUEST) public R<?> missingServletRequestParameterException(org.springframework.web.bind.MissingServletRequestParameterException ex)
    • nullPointerException

      @ExceptionHandler(java.lang.NullPointerException.class) @ResponseStatus(BAD_REQUEST) public R<?> nullPointerException(NullPointerException ex)
    • illegalArgumentException

      @ExceptionHandler(java.lang.IllegalArgumentException.class) @ResponseStatus(BAD_REQUEST) public R<?> illegalArgumentException(IllegalArgumentException ex)
    • httpMediaTypeNotSupportedException

      @ExceptionHandler(org.springframework.web.HttpMediaTypeNotSupportedException.class) @ResponseStatus(BAD_REQUEST) public R<?> httpMediaTypeNotSupportedException(org.springframework.web.HttpMediaTypeNotSupportedException ex)
    • missingServletRequestPartException

      @ExceptionHandler(org.springframework.web.multipart.support.MissingServletRequestPartException.class) @ResponseStatus(BAD_REQUEST) public R<?> missingServletRequestPartException(org.springframework.web.multipart.support.MissingServletRequestPartException ex)
    • servletException

      @ExceptionHandler(jakarta.servlet.ServletException.class) @ResponseStatus(BAD_REQUEST) public R<?> servletException(jakarta.servlet.ServletException ex)
    • multipartException

      @ExceptionHandler(org.springframework.web.multipart.MultipartException.class) @ResponseStatus(BAD_REQUEST) public R<?> multipartException(org.springframework.web.multipart.MultipartException ex)
    • constraintViolationException

      @ExceptionHandler(jakarta.validation.ConstraintViolationException.class) @ResponseStatus(BAD_REQUEST) public R<?> constraintViolationException(jakarta.validation.ConstraintViolationException ex)
      jsr 规范中的验证异常
    • methodArgumentNotValidException

      @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class) @ResponseStatus(BAD_REQUEST) public R<?> methodArgumentNotValidException(org.springframework.web.bind.MethodArgumentNotValidException ex)
      spring 封装的参数验证异常, 在controller中没有写result参数时,会进入
    • otherExceptionHandler

      @ExceptionHandler(java.lang.Exception.class) @ResponseStatus(BAD_REQUEST) public R<?> otherExceptionHandler(Exception ex)
      其他异常
      参数:
      ex - 异常
    • handleHttpRequestMethodNotSupportedException

      @ExceptionHandler(org.springframework.web.HttpRequestMethodNotSupportedException.class) @ResponseStatus(BAD_REQUEST) public R<?> handleHttpRequestMethodNotSupportedException(org.springframework.web.HttpRequestMethodNotSupportedException ex)
      返回状态码:405
    • persistenceException

      @ExceptionHandler(org.apache.ibatis.exceptions.PersistenceException.class) @ResponseStatus(BAD_REQUEST) public R<?> persistenceException(org.apache.ibatis.exceptions.PersistenceException ex)
    • myBatisSystemException

      @ExceptionHandler(org.mybatis.spring.MyBatisSystemException.class) @ResponseStatus(BAD_REQUEST) public R<?> myBatisSystemException(org.mybatis.spring.MyBatisSystemException ex)
    • sqlException

      @ExceptionHandler(java.sql.SQLException.class) @ResponseStatus(BAD_REQUEST) public R<?> sqlException(SQLException ex)
    • dataIntegrityViolationException

      @ExceptionHandler(org.springframework.dao.DataIntegrityViolationException.class) @ResponseStatus(BAD_REQUEST) public R<?> dataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException ex)