|
|
|
@ -4,14 +4,14 @@ import cn.chjyj.szwh.exception.ChException; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.springframework.web.bind.annotation.ControllerAdvice; |
|
|
|
import org.springframework.web.bind.annotation.ExceptionHandler; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.RestControllerAdvice; |
|
|
|
|
|
|
|
/** |
|
|
|
* 全局异常控制器 |
|
|
|
*/ |
|
|
|
@ControllerAdvice |
|
|
|
@RestControllerAdvice |
|
|
|
public class GlobalErrorController { |
|
|
|
//日志初始化
|
|
|
|
private static final Log log = LogFactory.getLog(GlobalErrorController.class); |
|
|
|
@ -21,7 +21,7 @@ public class GlobalErrorController { |
|
|
|
* 异常信息输出 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ExceptionHandler(ChException.class) |
|
|
|
@ExceptionHandler(value = ChException.class) |
|
|
|
@ResponseBody |
|
|
|
public JSONObject aisHandler(ChException ais){ |
|
|
|
log.error("Exception:"+ais); |
|
|
|
|