diff --git a/error.py b/error.py index 3a8c3e9..23f633c 100644 --- a/error.py +++ b/error.py @@ -1,15 +1,21 @@ -class dtMemoryError(Exception): +class MemoryError(Exception): pass -class AddressError(dtMemoryError): +class AddressError(MemoryError): + def __init__(self, index=None): + super().__init__(self) + if not index: + self.errorinfo = "None" + else: + self.errorinfo = str(hex(index)) + + def __str__(self): + return self.errorinfo + +class OutOfMemory(MemoryError): pass - -class OutOfMemory(dtMemoryError): - pass - - class InstructionError(Exception): pass @@ -20,3 +26,4 @@ class InvalidInstruction(InstructionError): class BadOperand(InstructionError): pass +