Skip to content

Commit

Permalink
refactor: improve error message for not found contracts (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanHolanda authored Sep 17, 2024
1 parent 19ea262 commit 47393d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/DevOpsTools.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ library DevOpsTools {
if (latestAddress != address(0)) {
return latestAddress;
} else {
revert("No contract deployed");
revert(
string.concat(
"No contract named ", "'", contractName, "'", " has been deployed on chain ", vm.toString(chainId)
)
);
}
}

Expand Down
11 changes: 10 additions & 1 deletion test/DevOpsToolsTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ contract DevOpsToolsTest is Test, ZkSyncChainChecker, FoundryZkSyncChecker {
function testExpectRevertIfNoDeployment() public skipZkSync onlyVanillaFoundry {
string memory contractName = "MissingContract";
uint256 chainId = 1234;
vm.expectRevert("No contract deployed");
vm.expectRevert(
bytes.concat(
"No contract named ",
"'",
bytes(contractName),
"'",
" has been deployed on chain ",
bytes(vm.toString(chainId))
)
);
DevOpsTools.get_most_recent_deployment(contractName, chainId, SEARCH_PATH);
}

Expand Down

0 comments on commit 47393d0

Please sign in to comment.