00b6d06041
We don't really want to do this in the FVM because it's Ethereum specific, but this makes sense to do in the Ethereum API. See: See https://docs.soliditylang.org/en/latest/control-structures.html#panic-via-assert-and-error-via-require
25 lines
479 B
Solidity
25 lines
479 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.17;
|
|
|
|
contract Errors {
|
|
error CustomError();
|
|
|
|
function failRevertEmpty() public {
|
|
revert();
|
|
}
|
|
function failRevertReason() public {
|
|
revert("my reason");
|
|
}
|
|
function failAssert() public {
|
|
assert(false);
|
|
}
|
|
function failDivZero() public {
|
|
int a = 1;
|
|
int b = 0;
|
|
a / b;
|
|
}
|
|
function failCustom() public {
|
|
revert CustomError();
|
|
}
|
|
}
|