Skip to content

Commit

Permalink
original errors
Browse files Browse the repository at this point in the history
  • Loading branch information
crosschainer committed May 18, 2024
1 parent 3b68212 commit 1fd955e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
9 changes: 1 addition & 8 deletions src/contracting/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,7 @@ def _abstract_function_call(
executor.sandbox.terminate()

if output['status_code'] == 1:
matches = re.match(r"Line \d+: (?P<exception_type>\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']

Expand Down
13 changes: 2 additions & 11 deletions src/contracting/execution/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1fd955e

Please sign in to comment.