mirror of https://gitee.com/xiaonuobase/snowy
【更新】更新启动后访问后端时异常提示语的处理
parent
6ed1b6004b
commit
0b58e4ee1f
|
@ -12,6 +12,9 @@
|
|||
*/
|
||||
package vip.xiaonuo.common.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import vip.xiaonuo.common.exception.CommonException;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
|
@ -32,7 +35,11 @@ public class CommonFilterExceptionUtil {
|
|||
**/
|
||||
public static void handleFilterException(ServletRequest request, ServletResponse response, Exception e) {
|
||||
try {
|
||||
request.setAttribute("model", e);
|
||||
if(ObjectUtil.isNotEmpty(e.getMessage())) {
|
||||
request.setAttribute("model", new CommonException(e.getMessage()));
|
||||
} else {
|
||||
request.setAttribute("model", e);
|
||||
}
|
||||
request.getRequestDispatcher("/errorView").forward(request, response);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue