Skip to content

Commit

Permalink
fix: add detail to exc only if brownie is connected
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Mar 24, 2023
1 parent 57357aa commit de77ade
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dank_mids/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def setup_dank_w3(async_w3: Web3) -> Web3:
async_w3.middleware_onion.add(geth_poa_middleware)
return async_w3
except ValueError as e:
if str(e) == "You can't add the same un-named instance twice":
raise ValueError("You can't add the same un-named instance twice. If you're calling 'setup_dank_w3' manually you may be better served by importing the pre-configured dank_web3 object from dank_mids.helpers.")
try:
from brownie import network
except ImportError:
raise e
if str(e) == "You can't add the same un-named instance twice" and network.is_connected():
raise ValueError("You can't add the same un-named instance twice. If you're using brownie and you're calling 'setup_dank_w3' manually you may be better served by importing the pre-configured dank_web3 object from dank_mids.helpers.")
raise e

def setup_dank_w3_from_sync(sync_w3: Web3) -> Web3:
Expand Down

0 comments on commit de77ade

Please sign in to comment.