Source code for iamai.adapter.onebot11.exceptions
"""CQHTTP 适配器异常。"""
from typing import Any, ClassVar, Dict
from iamai.exceptions import AdapterException
__all__ = [
"CQHTTPException",
"NetworkError",
"ActionFailed",
"ApiNotAvailable",
"ApiTimeout",
]
[docs]
class ActionFailed(CQHTTPException):
"""API 请求成功响应,但响应表示 API 操作失败。"""
def __init__(self, resp: Dict[str, Any]) -> None:
"""初始化。
Args:
resp: 返回的响应。
"""
self.resp = resp
[docs]
class ApiNotAvailable(ActionFailed):
"""API 请求返回 404,表示当前请求的 API 不可用或不存在。"""
ERROR_CODE: ClassVar[int] = 1404