How to use the aiocqhttp.exceptions.ApiError function in aiocqhttp

To help you get started, we’ve selected a few aiocqhttp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github richardchien / python-aiocqhttp / aiocqhttp / exceptions.py View on Github external
class ApiNotAvailable(Error):
    pass


class ApiError(Error, RuntimeError):
    pass


class HttpFailed(ApiError):
    """HTTP status code is not 2xx."""

    def __init__(self, status_code):
        self.status_code = status_code


class ActionFailed(ApiError):
    """
    Action failed to execute.

    >>> except ActionFailed as e:
    >>>     if e.retcode > 0:
    >>>         pass  # error code returned by HTTP API
    >>>     elif e.retcode < 0:
    >>>         pass  # error code returned by CoolQ
    """

    def __init__(self, retcode):
        self.retcode = retcode


class NetworkError(Error, IOError):
    pass
github richardchien / python-aiocqhttp / aiocqhttp / exceptions.py View on Github external
class Error(Exception):
    pass


class ApiNotAvailable(Error):
    pass


class ApiError(Error, RuntimeError):
    pass


class HttpFailed(ApiError):
    """HTTP status code is not 2xx."""

    def __init__(self, status_code):
        self.status_code = status_code


class ActionFailed(ApiError):
    """
    Action failed to execute.

    >>> except ActionFailed as e:
    >>>     if e.retcode > 0:
    >>>         pass  # error code returned by HTTP API
    >>>     elif e.retcode < 0:
    >>>         pass  # error code returned by CoolQ
    """