|
|
@@ -1,8 +1,11 @@
|
|
|
package com.ufo.base.framework.web.exception;
|
|
|
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.dao.DataAccessException;
|
|
|
import org.springframework.security.access.AccessDeniedException;
|
|
|
import org.springframework.validation.BindException;
|
|
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|
|
@@ -127,5 +130,11 @@ public class GlobalExceptionHandler
|
|
|
return AjaxResult.error(message);
|
|
|
}
|
|
|
|
|
|
+ @ExceptionHandler(DataAccessException.class)
|
|
|
+ public AjaxResult handleDbException(DataAccessException e){
|
|
|
+ String uuid = UUID.randomUUID().toString();
|
|
|
+ log.error("error happened, traceid# {}, error message {}", uuid, e);
|
|
|
+ return AjaxResult.error("系统异常,请联系管理员。TRACEID# " + uuid);
|
|
|
+ }
|
|
|
|
|
|
}
|