Skip to content

Commit

Permalink
feat: include provider name in impersonate account error (#2507)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Feb 15, 2025
1 parent f26546f commit d927196
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/ape/managers/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ def impersonate_account(self, address: AddressType) -> ImpersonatedAccount:
try:
result = self.provider.unlock_account(address)
except NotImplementedError as err:
raise AccountsError("Your provider does not support impersonating accounts.") from err
raise AccountsError(
f"Provider '{self.provider.name}' does not support impersonating accounts."
) from err

if result:
if address in self._impersonated_accounts:
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_autosign_transactions(runner, keyfile_account, receiver):

def test_impersonate_not_implemented(accounts, address):
expected_err_msg = (
r"Your provider does not support impersonating accounts:\\n"
r"Provider 'test' does not support impersonating accounts:\\n"
rf"No account with address '{address}'\."
)
with pytest.raises(KeyError, match=expected_err_msg):
Expand All @@ -522,7 +522,7 @@ def test_impersonated_account_ignores_signature_check_on_txn(accounts, address):

def test_contract_as_sender_non_fork_network(contract_instance):
expected_err_msg = (
r"Your provider does not support impersonating accounts:\\n"
r"Provider 'test' does not support impersonating accounts:\\n"
rf"No account with address '{contract_instance}'\."
)
with pytest.raises(KeyError, match=expected_err_msg):
Expand Down

0 comments on commit d927196

Please sign in to comment.