Remove unnecessary try-except, catch more errors

pull/2521/head
Bogdan Opanchuk 2021-01-13 22:56:47 -08:00
parent 11fe19db72
commit ad89ca7b67
1 changed files with 2 additions and 6 deletions

View File

@ -403,17 +403,13 @@ class BlockchainInterface:
# TODO: #1504 - Additional Handling of validation failures (gas limits, invalid fields, etc.)
"""
try:
response = exception.args[0]
except (AttributeError, TypeError):
# Python exceptions must have the 'args' attribute which must be a sequence (i.e. indexable)
raise ValueError(f'{exception} is not a valid Exception instance')
response = exception.args[0]
# Assume this error is formatted as an RPC response
try:
code = int(response['code'])
message = response['message']
except (KeyError, ValueError):
except Exception:
# TODO: #1504 - Try even harder to determine if this is insufficient funds causing the issue,
# This may be best handled at the agent or actor layer for registry and token interactions.
# Worst case scenario - raise the exception held in context implicitly