Skip to content

Commit 847c823

Browse files
authored
add reRevert util func for bubbling up errors (#60)
1 parent 91f266e commit 847c823

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Utils.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ function fromUniversalAddress(bytes32 universalAddr) pure returns (address addr)
1616
addr := universalAddr
1717
}
1818
}
19+
20+
/**
21+
* Reverts with a given buffer data.
22+
* Meant to be used to easily bubble up errors from low level calls when they fail.
23+
*/
24+
function reRevert(bytes memory err) pure {
25+
assembly ("memory-safe") {
26+
revert(add(err, 32), mload(err))
27+
}
28+
}

0 commit comments

Comments
 (0)