voicemeeter-api-python/voicemeeterlib/error.py
onyx-and-iris bafaa58507 extends error class
now accepts a custom message

fn_name and error code stored as class attributes
2023-07-10 15:36:38 +01:00

20 lines
556 B
Python

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