|
|
@@ -1,20 +1,15 @@
|
|
|
package com.uas.eis.exception;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-
|
|
|
import com.uas.eis.entity.ErrorMsg;
|
|
|
import org.apache.log4j.Logger;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
|
|
|
|
-import com.uas.eis.utils.StringUtil;
|
|
|
-
|
|
|
-
|
|
|
@ControllerAdvice
|
|
|
public class ExceptionHandlerAdvice {
|
|
|
|
|
|
@@ -30,8 +25,9 @@ public class ExceptionHandlerAdvice {
|
|
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
@ResponseBody
|
|
|
public ModelMap handleUnexpectedServerError(RuntimeException ex, HttpServletRequest request) {
|
|
|
+ logger.error("error",ex);
|
|
|
+
|
|
|
ModelMap map = new ModelMap();
|
|
|
- //logger.error(ex);
|
|
|
ex.printStackTrace();
|
|
|
map.put("errCode", -1);
|
|
|
map.put("errMsg", "server error");
|
|
|
@@ -49,6 +45,8 @@ public class ExceptionHandlerAdvice {
|
|
|
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
|
|
|
@ResponseBody
|
|
|
public ModelMap handleSystemError(SystemException ex, HttpServletRequest request) {
|
|
|
+ logger.error("error",ex);
|
|
|
+
|
|
|
ModelMap map = new ModelMap();
|
|
|
ErrorMsg errorMsg = ex.getErrorMsg();
|
|
|
map.put("errCode", errorMsg.getErrCode());
|
|
|
@@ -56,7 +54,4 @@ public class ExceptionHandlerAdvice {
|
|
|
map.put("errDesc",errorMsg.getErrDesc());
|
|
|
return map;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|