diff --git a/royalnet/bots/generic.py b/royalnet/bots/generic.py index f977254d..9ad032b9 100644 --- a/royalnet/bots/generic.py +++ b/royalnet/bots/generic.py @@ -64,7 +64,7 @@ class GenericBot: async def net_request(ci, request: rh.Request, destination: str) -> dict: if self.network is None: - raise InvalidConfigError("Royalnet is not enabled on this bot") + raise Exception("Royalnet is not enabled on this bot") response_dict: dict = await self.network.request(request.to_dict(), destination) if "type" not in response_dict: raise RoyalnetResponseError("Response is missing a type") @@ -117,13 +117,13 @@ class GenericBot: except Exception as e: sentry_sdk.capture_exception(e) log.debug(f"Exception {e} in {network_handler}") - return rh.ResponseError("exception_in_handler", - f"An exception was raised in {network_handler} for {request.handler}. Check " - f"extra_info for details.", - extra_info={ - "type": e.__class__.__name__, - "str": str(e) - }).to_dict() + return rh.ResponseFailure("exception_in_handler", + f"An exception was raised in {network_handler} for {request.handler}. Check " + f"extra_info for details.", + extra_info={ + "type": e.__class__.__name__, + "str": str(e) + }).to_dict() def _init_database(self): """Create an :py:class:`royalnet.database.Alchemy` with the tables required by the commands. Then, diff --git a/royalnet/error.py b/royalnet/error.py index 79133af7..7a1ac5db 100644 --- a/royalnet/error.py +++ b/royalnet/error.py @@ -1,14 +1,13 @@ import typing -if typing.TYPE_CHECKING: - from .network import ResponseError +import royalherald as rh class RoyalnetRequestError(Exception): """An error was raised while handling the Royalnet request. - This exception contains the :py:class:`royalnet.network.ResponseError` that was returned by the other Link.""" - def __init__(self, error: "ResponseError"): - self.error: "ResponseError" = error + This exception contains the :py:class:`royalherald.ResponseFailure` that was returned by the other Link.""" + def __init__(self, error: rh.ResponseFailure): + self.error: rh.ResponseFailure = error @property def args(self): @@ -16,4 +15,4 @@ class RoyalnetRequestError(Exception): class RoyalnetResponseError(Exception): - """The :py:class:`royalnet.network.Response` that was received is invalid.""" + """The :py:class:`royalherald.Response` that was received is invalid."""