defi-wonderland / smock

The Solidity mocking library
MIT License
319 stars 40 forks source link

feat: return hardhat errors on factory failures #125

Closed 5h4z4mm closed 2 years ago

5h4z4mm commented 2 years ago

Description Return Hardhat errors if ethers interface creation fails when setting up fake contract.

Before change - generic error returned

unable to generate smock spec from string

After change - Hardhat error message returned Example: When incorrect / non-existent contract name is used to create a fake.

unable to generate smock spec from contract name, HH701: There are multiple artifacts for contract "Storage", please use a fully qualified name. Please replace Storage for one of these options wherever you are trying to read its artifact: test/contracts/watchable-function-logic/Storage.sol:Storage test/contracts/watchable-function-logic/StorageDuplicate.sol:Storage

smartcontracts commented 2 years ago

Thanks for the PR!

5h4z4mm commented 2 years ago

Cosmetic update - error message format updated. Updated error message looks like,

unable to generate smock spec from contract name.
HH701: There are multiple artifacts for contract "Storage", please use a fully qualified name.

Please replace Storage for one of these options wherever you are trying to read its artifact:

test/contracts/watchable-function-logic/Storage.sol:Storage
test/contracts/watchable-function-logic/StorageDuplicate.sol:Storage