Skip to content

Commit 47393d0

Browse files
authored
refactor: improve error message for not found contracts (#27)
1 parent 19ea262 commit 47393d0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/DevOpsTools.sol

+5-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ library DevOpsTools {
6060
if (latestAddress != address(0)) {
6161
return latestAddress;
6262
} else {
63-
revert("No contract deployed");
63+
revert(
64+
string.concat(
65+
"No contract named ", "'", contractName, "'", " has been deployed on chain ", vm.toString(chainId)
66+
)
67+
);
6468
}
6569
}
6670

test/DevOpsToolsTest.t.sol

+10-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ contract DevOpsToolsTest is Test, ZkSyncChainChecker, FoundryZkSyncChecker {
3535
function testExpectRevertIfNoDeployment() public skipZkSync onlyVanillaFoundry {
3636
string memory contractName = "MissingContract";
3737
uint256 chainId = 1234;
38-
vm.expectRevert("No contract deployed");
38+
vm.expectRevert(
39+
bytes.concat(
40+
"No contract named ",
41+
"'",
42+
bytes(contractName),
43+
"'",
44+
" has been deployed on chain ",
45+
bytes(vm.toString(chainId))
46+
)
47+
);
3948
DevOpsTools.get_most_recent_deployment(contractName, chainId, SEARCH_PATH);
4049
}
4150

0 commit comments

Comments
 (0)