@RestControllerAdvice public class GlobalExceptionHandlerResolver extends Object
| 构造器和说明 |
|---|
GlobalExceptionHandlerResolver() |
| 限定符和类型 | 方法和说明 |
|---|---|
R |
classCastExceptionHandler()
类型转换异常
|
R |
httpMediaTypeNotSupportedExceptionHandler()
媒体格式不支持
|
R |
indexOutOfBoundsExceptionHandler()
数组越界异常
|
R |
iOExceptionHandler()
IO异常
|
R |
methodArgumentNotValidExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException e)
参数错误
|
R |
noSuchMethodExceptionHandler()
未知方法异常
|
R |
notFoundException()
404
|
R |
nullPointerExceptionHandler(Exception e)
空指针异常
|
R |
request405()
405错误
|
R |
request406()
406错误
|
R |
requestMissingServletRequest()
400错误 缺少参数
|
R |
requestNotReadable()
400错误
|
R |
requestTypeMismatch()
400错误 类型不匹配
|
R |
resolveMyException(ParamCheckException ex)
处理自定义的异常
|
R |
runtimeExceptionHandler(RuntimeException e)
RuntimeException
|
R |
server500()
500错误
|
R |
serverErrorExceptionHandler(org.springframework.web.server.ServerErrorException e)
ServerErrorException
|
R |
unKnowExceptionHandler()
Exception
|
@ExceptionHandler(value=java.lang.Exception.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R unKnowExceptionHandler()
@ExceptionHandler(value=java.lang.RuntimeException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R runtimeExceptionHandler(RuntimeException e)
e - RuntimeException@ExceptionHandler(value=java.lang.NullPointerException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R nullPointerExceptionHandler(Exception e)
@ExceptionHandler(value=java.lang.ClassCastException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R classCastExceptionHandler()
@ExceptionHandler(value=java.io.IOException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R iOExceptionHandler()
@ExceptionHandler(value=java.lang.NoSuchMethodException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R noSuchMethodExceptionHandler()
@ExceptionHandler(value=java.lang.IndexOutOfBoundsException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R indexOutOfBoundsExceptionHandler()
@ExceptionHandler(value=org.springframework.http.converter.HttpMessageNotReadableException.class) @ResponseStatus(value=BAD_REQUEST) public R requestNotReadable()
@ExceptionHandler(value=org.springframework.beans.TypeMismatchException.class) @ResponseStatus(value=BAD_REQUEST) public R requestTypeMismatch()
@ExceptionHandler(value=org.springframework.web.bind.MissingServletRequestParameterException.class) @ResponseStatus(value=BAD_REQUEST) public R requestMissingServletRequest()
@ExceptionHandler(value=org.springframework.web.bind.MethodArgumentNotValidException.class) @ResponseStatus(value=BAD_REQUEST) public R methodArgumentNotValidExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException e)
@ExceptionHandler(value=ParamCheckException.class) @ResponseStatus(value=BAD_REQUEST) public R resolveMyException(ParamCheckException ex)
ex - @ExceptionHandler(value=org.springframework.web.HttpRequestMethodNotSupportedException.class) @ResponseStatus(value=METHOD_NOT_ALLOWED) public R request405()
@ExceptionHandler(value=org.springframework.web.HttpMediaTypeNotAcceptableException.class) @ResponseStatus(value=NOT_ACCEPTABLE) public R request406()
@ExceptionHandler(value={org.springframework.beans.ConversionNotSupportedException.class,org.springframework.http.converter.HttpMessageNotWritableException.class})
@ResponseStatus(value=INTERNAL_SERVER_ERROR)
public R server500()
@ExceptionHandler(value=org.springframework.web.HttpMediaTypeNotSupportedException.class) @ResponseStatus(value=UNSUPPORTED_MEDIA_TYPE) public R httpMediaTypeNotSupportedExceptionHandler()
@ExceptionHandler(value=org.springframework.web.servlet.NoHandlerFoundException.class) @ResponseStatus(value=NOT_FOUND) public R notFoundException()
@ExceptionHandler(value=org.springframework.web.server.ServerErrorException.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) public R serverErrorExceptionHandler(org.springframework.web.server.ServerErrorException e)
e - Copyright © 2021. All rights reserved.