package com.ruoyi.web.exception; import com.ruoyi.common.core.domain.AjaxResult; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; /** * @Version 1.0 * @Author Jin_quan Ou * @Date 2023-03-23 18:40 */ @Slf4j //@RestControllerAdvice public class MyExceptionHandler { @ExceptionHandler(Exception.class) public AjaxResult error(Exception e){ log.error("未知异常:{}",e.getMessage()); return AjaxResult.error("未知异常,请联系管理员"); } }