|
@@ -3,8 +3,11 @@ package com.fdkankan.ucenter.exception;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.catalina.connector.ClientAbortException;
|
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
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;
|
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -41,4 +44,11 @@ public class GlobalExceptionHandler {
|
|
|
public Result businessExceptionHandler2(com.fdkankan.ucenter.exception.BusinessException e) {
|
|
public Result businessExceptionHandler2(com.fdkankan.ucenter.exception.BusinessException e) {
|
|
|
return Result.failure(e.getCode(), e.getMessage());
|
|
return Result.failure(e.getCode(), e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @ResponseBody
|
|
|
|
|
+ @ExceptionHandler(ClientAbortException.class)
|
|
|
|
|
+ public Result handleClientAbortException(ClientAbortException e) {
|
|
|
|
|
+ log.warn("客户端提前断开连接: {}", e.getMessage());
|
|
|
|
|
+ return Result.failure(200, "");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|