mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2026-04-18 12:33:34 +00:00
extends error class
now accepts a custom message fn_name and error code stored as class attributes
This commit is contained in:
@@ -5,6 +5,15 @@ class InstallError(Exception):
|
||||
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"""
|
||||
|
||||
Reference in New Issue
Block a user