捕获IoException: Broken pip并处理
This commit is contained in:
parent
230f172b51
commit
9d0ed1ff9c
|
|
@ -14,6 +14,8 @@ import org.springframework.web.context.request.ServletWebRequest;
|
|||
import org.springframework.web.context.request.WebRequest;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*
|
||||
|
|
@ -77,6 +79,11 @@ public class SqxExceptionHandler {
|
|||
return new ResponseEntity<>(HttpStatus.TOO_MANY_REQUESTS);
|
||||
}
|
||||
|
||||
@ExceptionHandler(IOException.class)
|
||||
public Result handleIoException() {
|
||||
return Result.error("请求中断,请重试");
|
||||
}
|
||||
|
||||
private void logErrorInfo(WebRequest webRequest) {
|
||||
if (webRequest instanceof ServletWebRequest) {
|
||||
ServletWebRequest servletWebRequest = (ServletWebRequest) webRequest;
|
||||
|
|
|
|||
Loading…
Reference in New Issue