chenlu
2024-06-07 2f640b1038fa331954f78ed1f4317212cf5bb34d
north-glass-erp/src/main/java/com/example/erp/exception/GlobalExceptionHandle.java
@@ -9,6 +9,8 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
@ControllerAdvice
public class GlobalExceptionHandle {
    /**
@@ -20,10 +22,11 @@
        return Result.error(se.getCode(),se.getMessage());
    }
    // 拦截:无权限异常
    @ExceptionHandler(NotPermissionException.class)
    @ResponseBody
    public Result handlerException(NotPermissionException e) {
        return Result.error(Constants.Code_401,"This user has no permission to access this resource");
        return Result.error(Constants.Code_401,e.getPermission());
    }
    // 拦截:未登录异常