package com.hzstoa.hzst.main.exception;
import com.hzstoa.hzst.commonweb.entity.ActionResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class ExceptionControllerAdvice {
@ExceptionHandler(value = Throwable.class)
public ActionResult handleException(Throwable throwable){
throwable.printStackTrace();
log.error(throwable.getMessage());
return ActionResult.fail("系统未知异常");
}
}
springBoot全局异常拦截
最新推荐文章于 2024-03-11 19:55:50 发布