临时提交

This commit is contained in:
648540858
2024-07-30 17:58:18 +08:00
parent 112cb2dfd8
commit 3ce973d2ee
17 changed files with 237 additions and 46 deletions

View File

@@ -52,6 +52,16 @@ public class GlobalExceptionHandler {
public WVPResult<String> exceptionHandler(HttpRequestMethodNotSupportedException e) {
return WVPResult.fail(ErrorCode.ERROR400);
}
/**
* 断言异常处理
* @param e 异常
* @return 统一返回结果
*/
@ExceptionHandler(IllegalArgumentException.class)
@ResponseStatus(HttpStatus.OK)
public WVPResult<String> exceptionHandler(IllegalArgumentException e) {
return WVPResult.fail(ErrorCode.ERROR100.getCode(), e.getMessage());
}
/**
@@ -60,7 +70,7 @@ public class GlobalExceptionHandler {
* @return 统一返回结果
*/
@ExceptionHandler(ControllerException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<WVPResult<String>> exceptionHandler(ControllerException e) {
return new ResponseEntity<>(WVPResult.fail(e.getCode(), e.getMsg()), HttpStatus.OK);
}