voicemeeter-api-python/voicemeeterlib/error.py

23 lines
644 B
Python
Raw Normal View History

class VMError(Exception):
"""Base VM Exception class. Raised when general errors occur."""
2022-06-16 14:07:12 +01:00
def __init__(self, msg):
self.message = msg
super().__init__(self.message)
def __str__(self):
return f"{type(self).__name__}: {self.message}"
2022-06-16 14:07:12 +01:00
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}")