|
@@ -22,7 +22,7 @@ import com.game.common.utils.StringUtils;
|
|
*
|
|
*
|
|
* @author recruit
|
|
* @author recruit
|
|
*/
|
|
*/
|
|
-@RestControllerAdvice
|
|
|
|
|
|
+//@RestControllerAdvice
|
|
public class GlobalExceptionHandler
|
|
public class GlobalExceptionHandler
|
|
{
|
|
{
|
|
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
|
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
|
@@ -68,6 +68,7 @@ public class GlobalExceptionHandler
|
|
public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request)
|
|
public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request)
|
|
{
|
|
{
|
|
String requestURI = request.getRequestURI();
|
|
String requestURI = request.getRequestURI();
|
|
|
|
+ e.printStackTrace();
|
|
log.error("请求路径中缺少必需的路径变量'{}',发生系统异常.", requestURI, e);
|
|
log.error("请求路径中缺少必需的路径变量'{}',发生系统异常.", requestURI, e);
|
|
return AjaxResult.error(String.format("请求路径中缺少必需的路径变量[%s]", e.getVariableName()));
|
|
return AjaxResult.error(String.format("请求路径中缺少必需的路径变量[%s]", e.getVariableName()));
|
|
}
|
|
}
|
|
@@ -90,7 +91,7 @@ public class GlobalExceptionHandler
|
|
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request)
|
|
public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request)
|
|
{
|
|
{
|
|
String requestURI = request.getRequestURI();
|
|
String requestURI = request.getRequestURI();
|
|
- log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
|
|
|
|
|
+ log.error("请求地址'{}',发生未知异常.,{}", requestURI, e);
|
|
return AjaxResult.error(e.getMessage());
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|