mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
fix: 通用异常处理
This commit is contained in:
parent
0afc7b1bbf
commit
eecbb2dd9c
@ -1,26 +0,0 @@
|
||||
package com.java2nb.novel.core.advice;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* 页面异常处理器
|
||||
*
|
||||
* @author 11797
|
||||
*/
|
||||
@Slf4j
|
||||
@ControllerAdvice(basePackages = "com.java2nb.novel.controller.page")
|
||||
public class PageExceptionHandler {
|
||||
|
||||
|
||||
/**
|
||||
* 处理所有异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String handlerException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
//跳转页面过程中出现异常时统一跳转到404页面
|
||||
return "404";
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user