2023-08-02 15:42:45 +01:00
|
|
|
class VMError(Exception):
|
2023-08-18 20:09:59 +01:00
|
|
|
"""Base voicemeeterlib exception class."""
|
2022-06-16 14:07:12 +01:00
|
|
|
|
|
|
|
|
2023-08-02 15:42:45 +01:00
|
|
|
class InstallError(VMError):
|
|
|
|
"""Exception raised when installation errors occur"""
|
|
|
|
|
|
|
|
|
|
|
|
class CAPIError(VMError):
|
|
|
|
"""Exception raised when the C-API returns an error code"""
|
|
|
|
|
2023-08-13 16:50:58 +01:00
|
|
|
def __init__(self, fn_name, code):
|
2023-08-02 15:42:45 +01:00
|
|
|
self.fn_name = fn_name
|
|
|
|
self.code = code
|
2023-08-13 16:50:58 +01:00
|
|
|
if self.code == -9:
|
|
|
|
message = " ".join(
|
|
|
|
(
|
|
|
|
f"no bind for {self.fn_name}.",
|
|
|
|
"are you using an old version of the API?",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
message = f"{self.fn_name} returned {self.code}"
|
|
|
|
super().__init__(message)
|