obsws-python/obsws_python/error.py

19 lines
555 B
Python
Raw Normal View History

2022-07-26 21:47:50 +01:00
class OBSSDKError(Exception):
"""Base class for OBSSDK errors"""
2022-07-26 21:47:50 +01:00
2023-06-19 17:44:10 +01:00
class OBSSDKTimeoutError(OBSSDKError):
2023-06-19 17:44:10 +01:00
"""Exception raised when a connection times out"""
class OBSSDKRequestError(OBSSDKError):
"""Exception raised when a request returns an error code"""
def __init__(self, req_name, code, comment):
self.req_name = req_name
self.code = code
message = f"Request {self.req_name} returned code {self.code}."
if comment:
message += f" With message: {comment}"
super().__init__(message)