From 1fd955e17b1506168b1b28ffc2e685f194518009 Mon Sep 17 00:00:00 2001 From: crosschainer Date: Sat, 18 May 2024 19:00:07 +0000 Subject: [PATCH] original errors --- src/contracting/client.py | 9 +-------- src/contracting/execution/executor.py | 13 ++----------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/contracting/client.py b/src/contracting/client.py index ada24b66..9405492f 100644 --- a/src/contracting/client.py +++ b/src/contracting/client.py @@ -182,14 +182,7 @@ def _abstract_function_call( executor.sandbox.terminate() if output['status_code'] == 1: - matches = re.match(r"Line \d+: (?P\w+) \(", output['result']) - try: - exception_type = matches.group('exception_type') - exception_class = getattr(___builtins___, exception_type) - raise exception_class(output['result']) - except AttributeError: - # If the exception type is not found, raise the output['result'] as a generic Exception. - raise Exception(output['result']) + raise output['result'] return output['result'] diff --git a/src/contracting/execution/executor.py b/src/contracting/execution/executor.py index 2b5efd9e..f9ece8dd 100644 --- a/src/contracting/execution/executor.py +++ b/src/contracting/execution/executor.py @@ -5,6 +5,7 @@ from contracting.stdlib.bridge.random import Seeded from contracting import constants from loguru import logger +import re from copy import deepcopy import importlib @@ -130,17 +131,7 @@ def execute(self, sender, contract_name, function_name, kwargs, driver.commit() except Exception as e: - tb = traceback.format_exc() - tb_info = traceback.extract_tb(e.__traceback__) - if contract_name == constants.SUBMISSION_CONTRACT_NAME: - filename, line, func, text = tb_info[-1] - line += 1 - else: - filename, line, func, text = tb_info[-1] - - result = f'Line {line}: {str(e.__class__.__name__)} ({str(e)})' - logger.error(str(e)) - logger.error(tb) + result = e status_code = 1 if auto_commit: