Skip to content

service输入错误或者不存在的时候,会发生AttributeError: 'NoneType' object has no attribute xxxx #51

Description

@yp05327

和#44类似的问题,如果srv不存在则应该返回正确的报错信息
例:

/ac limit ls --srv 不存在的service名

track:

  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/matcher.py", line 40, in handle_cmd
    await handle_ac(f, "ac " + cmd_body)
  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/__init__.py", line 43, in handle_ac
    async with _handing_error(fout):
  File "/usr/local/lib/python3.12/contextlib.py", line 231, in __aexit__
    await self.gen.athrow(value)
> File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/__init__.py", line 37, in _handing_error
    yield
  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/__init__.py", line 50, in handle_ac
    await _handle_limit(fout, result)
  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/__init__.py", line 120, in _handle_limit
    await limit_handler.ls(
  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/utils/permission.py", line 17, in wrapper
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/nonebot_plugin_access_control/handler/limit_handler.py", line 98, in ls
    rules = [x async for x in service.get_rate_limit_rules()]
AttributeError: 'NoneType' object has no attribute 'get_rate_limit_rules'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions