mirror of
https://github.com/onyx-and-iris/obsws-cli.git
synced 2025-07-18 02:41:47 +00:00
add custom error class + exit codes
This commit is contained in:
parent
8349a196e8
commit
032b957670
16
obsws_cli/enum.py
Normal file
16
obsws_cli/enum.py
Normal file
@ -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()
|
11
obsws_cli/error.py
Normal file
11
obsws_cli/error.py
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user