1. 修正语法检查

This commit is contained in:
黄昕 2024-03-25 16:36:03 +08:00
parent 7149e5597b
commit 91eab74af8
1 changed files with 31 additions and 0 deletions

View File

@ -23,9 +23,20 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* The type Controller exception handler.
*
* @author xajhuang @163.com
*/
@ControllerAdvice
@Slf4j
public class ControllerExceptionHandler {
/**
* Controller not found protocol resp.
*
* @param e the e
* @return the protocol resp
*/
@ExceptionHandler(NoHandlerFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
@ResponseBody
@ -38,6 +49,12 @@ public class ControllerExceptionHandler {
errMsg.toArray(new String[0]));
}
/**
* Controller global exception protocol resp.
*
* @param e the e
* @return the protocol resp
*/
@ExceptionHandler({MethodArgumentNotValidException.class})
@ResponseBody
public ProtocolResp<BaseRespStatus> controllerGlobalException(MethodArgumentNotValidException e) {
@ -52,6 +69,12 @@ public class ControllerExceptionHandler {
errMsg.toArray(new String[0]));
}
/**
* Common error exception protocol resp.
*
* @param ex the ex
* @return the protocol resp
*/
@ExceptionHandler({CommonErrorCodeException.class})
@ResponseBody
public ProtocolResp<BaseRespStatus> commonErrorException(Exception ex) {
@ -60,6 +83,14 @@ public class ControllerExceptionHandler {
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)
@ResponseBody
public ProtocolResp<BaseRespStatus> handleException(HttpServletResponse rsp,