From bd1b011046a13858cee97fee55c9f87e3c6591af Mon Sep 17 00:00:00 2001 From: moyan <1561515308@qq.com> Date: Tue, 7 May 2024 16:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- error.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) 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 +