1. 修正语法检查
This commit is contained in:
parent
7149e5597b
commit
91eab74af8
|
@ -23,9 +23,20 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Controller exception handler.
|
||||||
|
*
|
||||||
|
* @author xajhuang @163.com
|
||||||
|
*/
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ControllerExceptionHandler {
|
public class ControllerExceptionHandler {
|
||||||
|
/**
|
||||||
|
* Controller not found protocol resp.
|
||||||
|
*
|
||||||
|
* @param e the e
|
||||||
|
* @return the protocol resp
|
||||||
|
*/
|
||||||
@ExceptionHandler(NoHandlerFoundException.class)
|
@ExceptionHandler(NoHandlerFoundException.class)
|
||||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -38,6 +49,12 @@ public class ControllerExceptionHandler {
|
||||||
errMsg.toArray(new String[0]));
|
errMsg.toArray(new String[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller global exception protocol resp.
|
||||||
|
*
|
||||||
|
* @param e the e
|
||||||
|
* @return the protocol resp
|
||||||
|
*/
|
||||||
@ExceptionHandler({MethodArgumentNotValidException.class})
|
@ExceptionHandler({MethodArgumentNotValidException.class})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ProtocolResp<BaseRespStatus> controllerGlobalException(MethodArgumentNotValidException e) {
|
public ProtocolResp<BaseRespStatus> controllerGlobalException(MethodArgumentNotValidException e) {
|
||||||
|
@ -52,6 +69,12 @@ public class ControllerExceptionHandler {
|
||||||
errMsg.toArray(new String[0]));
|
errMsg.toArray(new String[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common error exception protocol resp.
|
||||||
|
*
|
||||||
|
* @param ex the ex
|
||||||
|
* @return the protocol resp
|
||||||
|
*/
|
||||||
@ExceptionHandler({CommonErrorCodeException.class})
|
@ExceptionHandler({CommonErrorCodeException.class})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ProtocolResp<BaseRespStatus> commonErrorException(Exception ex) {
|
public ProtocolResp<BaseRespStatus> commonErrorException(Exception ex) {
|
||||||
|
@ -60,6 +83,14 @@ public class ControllerExceptionHandler {
|
||||||
new String[] {ex.getMessage()});
|
new String[] {ex.getMessage()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle exception protocol resp.
|
||||||
|
*
|
||||||
|
* @param rsp the rsp
|
||||||
|
* @param req the req
|
||||||
|
* @param ex the ex
|
||||||
|
* @return the protocol resp
|
||||||
|
*/
|
||||||
@ExceptionHandler(SecurityProtocolException.class)
|
@ExceptionHandler(SecurityProtocolException.class)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ProtocolResp<BaseRespStatus> handleException(HttpServletResponse rsp,
|
public ProtocolResp<BaseRespStatus> handleException(HttpServletResponse rsp,
|
||||||
|
|
Loading…
Reference in New Issue