Class GlobalExceptionHandler

java.lang.Object
com.imyeyu.spring.util.GlobalExceptionHandler

@RestControllerAdvice public class GlobalExceptionHandler extends Object
全局异常处理器
Version:
2023-05-06 16:28
Author:
夜雨
  • Constructor Details

    • GlobalExceptionHandler

      public GlobalExceptionHandler()
      创建全局异常处理器
  • Method Details

    • conversionException

      @ExceptionHandler(org.springframework.http.converter.HttpMessageConversionException.class) public com.imyeyu.java.bean.timi.TimiResponse<?> conversionException(org.springframework.http.converter.HttpMessageConversionException e)
      消息转换异常
      Parameters:
      e - 异常
      Returns:
      异常返回
    • headerException

      @ExceptionHandler(jakarta.servlet.ServletException.class) public com.imyeyu.java.bean.timi.TimiResponse<?> headerException(jakarta.servlet.ServletException e)
      请求异常
      Parameters:
      e - 异常
      Returns:
      异常返回
    • paramsException

      @ExceptionHandler({org.springframework.validation.BindException.class,jakarta.validation.ValidationException.class,org.springframework.web.bind.MethodArgumentNotValidException.class,org.springframework.beans.TypeMismatchException.class}) public com.imyeyu.java.bean.timi.TimiResponse<?> paramsException(Exception e)
      接口入参基本校验异常
      Parameters:
      e - 异常
      Returns:
      异常返回
    • error

      @ExceptionHandler(java.lang.Throwable.class) public com.imyeyu.java.bean.timi.TimiResponse<?> error(Throwable e)
      全局异常
      Parameters:
      e - 异常
      Returns:
      异常返回