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