额外的异常
This commit is contained in:
@@ -12,6 +12,7 @@ import org.springframework.dao.DuplicateKeyException;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
@@ -125,6 +126,15 @@ public class CzgControllerAdvice {
|
|||||||
// return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), ex.getMessage());
|
// return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), ex.getMessage());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get/post 等方法不支持异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
|
public CzgResult<Object> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException ex) {
|
||||||
|
return CzgResult.failure(CzgRespCode.UN_PERMISSION.getCode(), ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理Hutool的校验工具类抛出异常
|
* 处理Hutool的校验工具类抛出异常
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user