chore: 忽略EofException打印信息

This commit is contained in:
fit2-zhao 2024-06-17 13:02:16 +08:00 committed by Craftsman
parent ae0732dc6c
commit b869df8428
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.lang.ShiroException;
import org.eclipse.jetty.io.EofException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
@ -114,6 +115,11 @@ public class RestControllerExceptionHandler {
@ExceptionHandler({Exception.class})
public ResponseEntity<ResultHolder> handlerException(Exception e) {
if (e instanceof EofException) {
return ResponseEntity.internalServerError()
.body(ResultHolder.error(MsHttpResultCode.FAILED.getCode(),
e.getMessage(), null));
}
return ResponseEntity.internalServerError()
.body(ResultHolder.error(MsHttpResultCode.FAILED.getCode(),
e.getMessage(), getStackTraceAsString(e)));