|
@@ -1,7 +1,9 @@
|
|
|
/*CopyRright (c)2014: <www.usoftchina.com>
|
|
/*CopyRright (c)2014: <www.usoftchina.com>
|
|
|
*/
|
|
*/
|
|
|
-package com.uas.report.exception;
|
|
|
|
|
|
|
+package com.uas.report.aop;
|
|
|
|
|
|
|
|
|
|
+import com.uas.report.util.ExceptionUtils;
|
|
|
|
|
+import org.apache.catalina.connector.ClientAbortException;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
import org.springframework.http.HttpHeaders;
|
|
@@ -11,8 +13,6 @@ import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
|
|
|
|
|
-import com.uas.report.util.ExceptionUtils;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 基于Application的异常处理,以AOP的形式注册到SpringMVC的处理链
|
|
* 基于Application的异常处理,以AOP的形式注册到SpringMVC的处理链
|
|
|
*
|
|
*
|
|
@@ -32,7 +32,11 @@ public class ExceptionHandlerAdvice {
|
|
|
*/
|
|
*/
|
|
|
@ExceptionHandler(Throwable.class)
|
|
@ExceptionHandler(Throwable.class)
|
|
|
public ResponseEntity<ModelMap> handleError(Throwable e) {
|
|
public ResponseEntity<ModelMap> handleError(Throwable e) {
|
|
|
- logger.error("", e);
|
|
|
|
|
|
|
+ if(e instanceof ClientAbortException){
|
|
|
|
|
+ logger.error(e.getMessage());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ logger.error("", e);
|
|
|
|
|
+ }
|
|
|
ModelMap map = new ModelMap();
|
|
ModelMap map = new ModelMap();
|
|
|
map.put("success", false);
|
|
map.put("success", false);
|
|
|
map.put("message", e.getMessage());
|
|
map.put("message", e.getMessage());
|