diff --git a/obsws_cli/enum.py b/obsws_cli/enum.py new file mode 100644 index 0000000..fca0fb5 --- /dev/null +++ b/obsws_cli/enum.py @@ -0,0 +1,16 @@ +"""module for exit codes used in the application.""" + +from enum import IntEnum, auto + + +class ExitCode(IntEnum): + """Exit codes for the application.""" + + SUCCESS = 0 + ERROR = auto() + INVALID_ARGUMENT = auto() + INVALID_PARAMETER = auto() + NOT_FOUND = auto() + ALREADY_EXISTS = auto() + TIMEOUT = auto() + UNKNOWN_ERROR = auto() diff --git a/obsws_cli/error.py b/obsws_cli/error.py new file mode 100644 index 0000000..33efaaa --- /dev/null +++ b/obsws_cli/error.py @@ -0,0 +1,11 @@ +"""module containing error handling for OBS WebSocket CLI.""" + + +class OBSWSCLIError(Exception): + """Base class for OBS WebSocket CLI errors.""" + + def __init__(self, message: str, code: int = 1): + """Initialize the error with a message and an optional code.""" + super().__init__(message) + self.message = message + self.code = code