Class CodeExceptionHandler

java.lang.Object
cloud.opencode.base.basecode.handler.CodeExceptionHandler

@RestControllerAdvice public class CodeExceptionHandler extends Object
Global exception handler 全局异常处理器
Author:
Jon url: Jon's blog url: OpenCode.cloud
  • Constructor Details

    • CodeExceptionHandler

      public CodeExceptionHandler()
  • Method Details

    • handleIllegalArgumentException

      @ExceptionHandler(java.lang.IllegalArgumentException.class) public CodeResult handleIllegalArgumentException(IllegalArgumentException e)
      Handle IllegalArgumentException 处理参数异常
      Parameters:
      e - IllegalArgumentException instance / 参数异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleSecurityException

      @ExceptionHandler(java.lang.SecurityException.class) public CodeResult handleSecurityException(SecurityException e)
      Handle SecurityException 处理安全异常
      Parameters:
      e - SecurityException instance / 安全异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleNullPointerException

      @ExceptionHandler(java.lang.NullPointerException.class) public CodeResult handleNullPointerException(NullPointerException e)
      Handle NullPointerException 处理空指针异常
      Parameters:
      e - NullPointerException instance / 空指针异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleNoHandlerFoundException

      @ExceptionHandler(org.springframework.web.servlet.NoHandlerFoundException.class) public CodeResult handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e)
      Handle NoHandlerFoundException 处理未找到处理器异常
      Parameters:
      e - NoHandlerFoundException instance / 未找到处理器异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleHttpMediaTypeNotSupportedException

      @ExceptionHandler(org.springframework.web.HttpMediaTypeNotSupportedException.class) public CodeResult handleHttpMediaTypeNotSupportedException(org.springframework.web.HttpMediaTypeNotSupportedException e)
      Handle HttpMediaTypeNotSupportedException 处理不支持的媒体类型异常
      Parameters:
      e - HttpMediaTypeNotSupportedException instance / 不支持的媒体类型异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleCodeException

      @ExceptionHandler(CodeException.class) public CodeResult handleCodeException(CodeException e)
      Handle CodeException 处理自定义异常
      Parameters:
      e - CodeException instance / 自定义异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleRuntimeException

      @ExceptionHandler(java.lang.RuntimeException.class) public CodeResult handleRuntimeException(RuntimeException e)
      Handle RuntimeException 处理运行时异常
      Parameters:
      e - RuntimeException instance / 运行时异常实例
      Returns:
      CodeResult instance / CodeResult实例
    • handleException

      @ExceptionHandler(java.lang.Exception.class) public CodeResult handleException(Exception e)
      Handle Exception 处理通用异常
      Parameters:
      e - Exception instance / 异常实例
      Returns:
      CodeResult instance / CodeResult实例