Commit a5e6ef4d by stylefeng

把ErrorTip类移到core

parent 7ac9c3c1
package com.stylefeng.guns.core.aop; package com.stylefeng.guns.core.aop;
import com.stylefeng.guns.common.constant.tips.ErrorTip;
import com.stylefeng.guns.common.exception.BizExceptionEnum; import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.common.exception.BussinessException; import com.stylefeng.guns.common.exception.BussinessException;
import com.stylefeng.guns.common.exception.InvalidKaptchaException; import com.stylefeng.guns.common.exception.InvalidKaptchaException;
import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.log.LogManager; import com.stylefeng.guns.core.log.LogManager;
import com.stylefeng.guns.core.log.factory.LogTaskFactory; import com.stylefeng.guns.core.log.factory.LogTaskFactory;
import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.shiro.ShiroKit;
...@@ -119,7 +119,7 @@ public class GlobalExceptionHandler { ...@@ -119,7 +119,7 @@ public class GlobalExceptionHandler {
public ErrorTip credentials(UndeclaredThrowableException e) { public ErrorTip credentials(UndeclaredThrowableException e) {
getRequest().setAttribute("tip", "权限异常"); getRequest().setAttribute("tip", "权限异常");
log.error("权限异常!", e); log.error("权限异常!", e);
return new ErrorTip(BizExceptionEnum.NO_PERMITION); return new ErrorTip(BizExceptionEnum.NO_PERMITION.getCode(),BizExceptionEnum.NO_PERMITION.getMessage());
} }
/** /**
...@@ -134,7 +134,7 @@ public class GlobalExceptionHandler { ...@@ -134,7 +134,7 @@ public class GlobalExceptionHandler {
LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e));
getRequest().setAttribute("tip", "服务器未知运行时异常"); getRequest().setAttribute("tip", "服务器未知运行时异常");
log.error("运行时异常:", e); log.error("运行时异常:", e);
return new ErrorTip(BizExceptionEnum.SERVER_ERROR); return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(),BizExceptionEnum.SERVER_ERROR.getMessage());
} }
/** /**
......
package com.stylefeng.guns.common.constant.tips; package com.stylefeng.guns.core.base.tips;
import com.stylefeng.guns.common.exception.BizExceptionEnum;
import com.stylefeng.guns.core.base.tips.Tip;
/** /**
* 返回给前台的错误提示 * 返回给前台的错误提示
...@@ -16,9 +13,4 @@ public class ErrorTip extends Tip { ...@@ -16,9 +13,4 @@ public class ErrorTip extends Tip {
this.code = code; this.code = code;
this.message = message; this.message = message;
} }
public ErrorTip(BizExceptionEnum bizExceptionEnum) {
this.code = bizExceptionEnum.getCode();
this.message = bizExceptionEnum.getMessage();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment