From 144ff5375297551b70e9948e622e0bcafb95eead Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 15 Mar 2019 14:57:13 +0100 Subject: [PATCH] Add possible command exceptions --- royalnet/utils/__init__.py | 4 ++-- royalnet/utils/command.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/royalnet/utils/__init__.py b/royalnet/utils/__init__.py index f752aa98..3e8886db 100644 --- a/royalnet/utils/__init__.py +++ b/royalnet/utils/__init__.py @@ -1,6 +1,6 @@ from .asyncify import asyncify from .call import Call -from .command import Command +from .command import Command, InvalidInputError, UnsupportedError from .safeformat import safeformat -__all__ = ["asyncify", "Call", "Command", "safeformat"] +__all__ = ["asyncify", "Call", "Command", "safeformat", "InvalidInputError", "UnsupportedError"] diff --git a/royalnet/utils/command.py b/royalnet/utils/command.py index 3bb44155..8b02eeba 100644 --- a/royalnet/utils/command.py +++ b/royalnet/utils/command.py @@ -3,6 +3,16 @@ if typing.TYPE_CHECKING: from .call import Call +class UnsupportedError(Exception): + """The command is not supported for the specified source.""" + pass + + +class InvalidInputError(Exception): + """The command has received invalid input and cannot complete.""" + pass + + class Command: """A generic command, called from any source."""