mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-15 16:40:46 +00:00
onyx-and-iris
bafaa58507
now accepts a custom message fn_name and error code stored as class attributes
20 lines
556 B
Python
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"""
|