-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
try to add custom error in require statement but shows error in foundry:
error emptyError();
function requireCustomEmpty() external view {
require(msg.sender == address(1), emptyError());
}
this is the test to get error:
// forge t --mt test_requireCustomEmpty -vvv
function test_requireCustomEmpty() external {
(, bytes memory data) = address(contractA).call(abi.encodeWithSignature("requireCustomEmpty()"));
console.logBytes(data); // return empty data '0x' similar to empty revert
}
the test shows error:
$ forge t --mt test_requireCustomEmpty -vvv
Compiler run failed:
Error (9322): No matching declaration found after argument-dependent lookup.
--> src/TryCatch.sol:14:9:
|
14 | require(msg.sender == address(1), emptyError());
| ^^^^^^^
Note: Candidate: function require(bool)
Note: Candidate: function require(bool, string memory)
Error:
Compilation failed
already added via-ir = true
in toml
Metadata
Metadata
Assignees
Labels
No labels