voicemeeter-api-python/voicemeeterlib/error.py
onyx-and-iris e96151cd5a InstallError and CAPIError classes
now subclass VMError

minor version bump
2023-08-02 15:42:45 +01:00

23 lines
644 B
Python

class VMError(Exception):
"""Base VM Exception class. Raised when general errors occur."""
def __init__(self, msg):
self.message = msg
super().__init__(self.message)
def __str__(self):
return f"{type(self).__name__}: {self.message}"
class InstallError(VMError):
"""Exception raised when installation errors occur"""
class CAPIError(VMError):
"""Exception raised when the C-API returns an error code"""
def __init__(self, fn_name, code, msg=None):
self.fn_name = fn_name
self.code = code
super(CAPIError, self).__init__(msg if msg else f"{fn_name} returned {code}")