zqy
2024-06-23 a69aafe60ce001834b981778f12fd74d4af77e23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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("未知异常,请联系管理员");
    }
}