增加异常处理器,细化异常提示

This commit is contained in:
赵俊
2021-09-19 14:10:09 +08:00
parent 187544fc06
commit 1136d582df

View File

@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.net.ConnectException;
/**
* 全局异常处理器
* @author zhaojun
@@ -106,6 +108,17 @@ public class GlobleExceptionHandler {
}
/**
* 登录异常拦截器
*/
@ExceptionHandler(ConnectException.class)
@ResponseBody
public ResultBean handlerConnectException(ConnectException e) {
return ResultBean.error("请求失败, 清稍后再试");
}
@ExceptionHandler
@ResponseBody
@ResponseStatus