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