@ControllerAdvice public class BaseExceptionAdvice extends Object
| 构造器和说明 |
|---|
BaseExceptionAdvice() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.springframework.http.ResponseEntity<ExceptionResult> |
handleException(SnowException e)
自定义异常处理方案
|
org.springframework.http.ResponseEntity<ExceptionResult> |
handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e)
全局404异常捕获
|
org.springframework.http.ResponseEntity<ExceptionResult> |
handleRuntimeException(RuntimeException e)
运行时异常处理方案
|
@ExceptionHandler(value=java.lang.RuntimeException.class) public org.springframework.http.ResponseEntity<ExceptionResult> handleRuntimeException(RuntimeException e)
e - @ExceptionHandler(value=SnowException.class) public org.springframework.http.ResponseEntity<ExceptionResult> handleException(SnowException e)
e - @ExceptionHandler(value=org.springframework.web.servlet.NoHandlerFoundException.class) public org.springframework.http.ResponseEntity<ExceptionResult> handleNoHandlerFoundException(org.springframework.web.servlet.NoHandlerFoundException e)
e - Copyright © 2022. All rights reserved.