删除无用代码

This commit is contained in:
2025-05-29 14:33:35 +08:00
parent c50cd84af0
commit 88cce9357d
3 changed files with 42 additions and 55 deletions

View File

@ -50,13 +50,15 @@ public class CustomExceptionHandle {
* 自定义异常统一处理类
*/
@ExceptionHandler(value = BizException.class)
public ApiResponse<String> handle(BizException bizException) {
public ApiResponse<String> handle(HttpServletResponse response, BizException bizException) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return ApiResponse.buildResponse(bizException.getCode(), bizException.getMsg());
}
@ExceptionHandler(value =IOException.class)
public ApiResponse<String> handle(IOException e) {
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
public ApiResponse<String> handle(HttpServletResponse response, IOException e) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
LOGGER.error("IO异常 -> {}", e.getMessage(), e);
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
}
@ -64,7 +66,8 @@ public class CustomExceptionHandle {
* 异常统一返回处理
*/
@ExceptionHandler(value = Exception.class)
public ApiResponse<String> handle(Exception e) {
public ApiResponse<String> handle(HttpServletResponse response, Exception e) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
}
@ -73,7 +76,8 @@ public class CustomExceptionHandle {
* 移动端自定义异常统一处理类
*/
@ExceptionHandler(value = AppException.class)
public ApiResponse<String> handle(AppException appException) {
public ApiResponse<String> handle(HttpServletResponse response, AppException appException) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return ApiResponse.buildResponse(appException.getCode(), appException.getMsg());
}
@ -81,7 +85,8 @@ public class CustomExceptionHandle {
* 移动端自定义异常统一处理类
*/
@ExceptionHandler(value = HttpMessageNotReadableException.class)
public ApiResponse<String> handle(HttpMessageNotReadableException httpMessageNotReadableException) {
public ApiResponse<String> handle(HttpServletResponse response, HttpMessageNotReadableException httpMessageNotReadableException) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return ApiResponse.buildResponse(500, "请求参数格式错误");
}