@ControllerAdvice
@ResponseBody
@ConditionalOnProperty(prefix="yishuifengxiao.error",
name="enable",
havingValue="true",
matchIfMissing=true)
public class WebExceptionAutoConfiguration
extends Object
| Constructor and Description |
|---|
WebExceptionAutoConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkConfig() |
Object |
handle(javax.servlet.http.HttpServletRequest request,
javax.validation.ConstraintViolationException e)
参数验证异常
|
Object |
handle(javax.servlet.http.HttpServletRequest request,
javax.validation.ValidationException e)
参数验证异常
|
Object |
handleCustomException(javax.servlet.http.HttpServletRequest request,
com.yishuifengxiao.common.tool.exception.CustomException e)
500 - 自定义异常
|
Object |
handleException(javax.servlet.http.HttpServletRequest request,
Exception e)
500 - Internal Server Error
|
Object |
handleHttpMediaTypeNotSupportedException(javax.servlet.http.HttpServletRequest request,
org.springframework.web.HttpMediaTypeNotSupportedException e)
415 - Unsupported Media Type
|
Object |
handleHttpMessageNotReadableException(javax.servlet.http.HttpServletRequest request,
org.springframework.http.converter.HttpMessageNotReadableException e)
400 - Bad Request
|
Object |
handleHttpRequestMethodNotSupportedException(javax.servlet.http.HttpServletRequest request,
org.springframework.web.HttpRequestMethodNotSupportedException e)
405 - Method Not Allowed
|
Object |
handleIllegalArgumentException(javax.servlet.http.HttpServletRequest request,
IllegalArgumentException e)
400 - Bad Request
|
Object |
handleIllegalStateException(javax.servlet.http.HttpServletRequest request,
IllegalStateException e)
500 - IllegalStateException
|
Object |
handleIndexOutOfBoundsException(javax.servlet.http.HttpServletRequest request,
IndexOutOfBoundsException e)
数组越界 - Internal Server Error
|
Object |
handleIoException(javax.servlet.http.HttpServletRequest request,
IOException e)
500 - Internal Server Error
|
Object |
handleMethodArgumentTypeMismatchException(javax.servlet.http.HttpServletRequest request,
org.springframework.web.method.annotation.MethodArgumentTypeMismatchException e) |
Object |
handleMissingServletRequestParameterException(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.MissingServletRequestParameterException e) |
Object |
handleNullPointerException(javax.servlet.http.HttpServletRequest request,
NullPointerException e)
500 - Internal Server Error
|
Object |
handleRuntimeException(javax.servlet.http.HttpServletRequest request,
RuntimeException e)
500 - IllegalStateException
|
Object |
handleServletException(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletException e)
500 - Internal Server Error
|
@ResponseStatus(value=OK) @ExceptionHandler(value=org.springframework.http.converter.HttpMessageNotReadableException.class) public Object handleHttpMessageNotReadableException(javax.servlet.http.HttpServletRequest request, org.springframework.http.converter.HttpMessageNotReadableException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.IllegalArgumentException.class) public Object handleIllegalArgumentException(javax.servlet.http.HttpServletRequest request, IllegalArgumentException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=org.springframework.web.HttpRequestMethodNotSupportedException.class) public Object handleHttpRequestMethodNotSupportedException(javax.servlet.http.HttpServletRequest request, org.springframework.web.HttpRequestMethodNotSupportedException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=org.springframework.web.HttpMediaTypeNotSupportedException.class) public Object handleHttpMediaTypeNotSupportedException(javax.servlet.http.HttpServletRequest request, org.springframework.web.HttpMediaTypeNotSupportedException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.NullPointerException.class) public Object handleNullPointerException(javax.servlet.http.HttpServletRequest request, NullPointerException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=javax.servlet.ServletException.class) public Object handleServletException(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.io.IOException.class) public Object handleIoException(javax.servlet.http.HttpServletRequest request, IOException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=org.springframework.web.bind.MissingServletRequestParameterException.class) public Object handleMissingServletRequestParameterException(javax.servlet.http.HttpServletRequest request, org.springframework.web.bind.MissingServletRequestParameterException e)
@ResponseStatus(value=OK) @ExceptionHandler(value=org.springframework.web.method.annotation.MethodArgumentTypeMismatchException.class) public Object handleMethodArgumentTypeMismatchException(javax.servlet.http.HttpServletRequest request, org.springframework.web.method.annotation.MethodArgumentTypeMismatchException e)
@ExceptionHandler @ResponseBody @ResponseStatus(value=OK) public Object handle(javax.servlet.http.HttpServletRequest request, javax.validation.ValidationException e)
request - HttpServletRequeste - 希望捕获的异常@ExceptionHandler @ResponseBody @ResponseStatus(value=OK) public Object handle(javax.servlet.http.HttpServletRequest request, javax.validation.ConstraintViolationException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.IndexOutOfBoundsException.class) public Object handleIndexOutOfBoundsException(javax.servlet.http.HttpServletRequest request, IndexOutOfBoundsException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=com.yishuifengxiao.common.tool.exception.CustomException.class) public Object handleCustomException(javax.servlet.http.HttpServletRequest request, com.yishuifengxiao.common.tool.exception.CustomException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.IllegalStateException.class) public Object handleIllegalStateException(javax.servlet.http.HttpServletRequest request, IllegalStateException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.RuntimeException.class) public Object handleRuntimeException(javax.servlet.http.HttpServletRequest request, RuntimeException e)
request - HttpServletRequeste - 希望捕获的异常@ResponseStatus(value=OK) @ExceptionHandler(value=java.lang.Exception.class) public Object handleException(javax.servlet.http.HttpServletRequest request, Exception e)
request - HttpServletRequeste - 希望捕获的异常@PostConstruct public void checkConfig()
Copyright © 2021. All rights reserved.