define exception hierarchy

allow is_running to return values x>=0
This commit is contained in:
2023-08-22 16:11:00 +01:00
parent 740cf1ac02
commit a2af0e704c
2 changed files with 19 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
class NVDAVMError(Exception):
"""Base NVDAVM error class"""
class NVDAVMCAPIError(NVDAVMError):
"""Exception raised when the NVDA C-API returns an error code"""
def __init__(self, fn_name, code):
self.fn_name = fn_name
self.code = code
super().__init__(f"{self.fn_name} returned {self.code}")