Skip to content

Commit

Permalink
add reRevert util func for bubbling up errors (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
nonergodic authored Sep 17, 2024
1 parent 91f266e commit 847c823
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ function fromUniversalAddress(bytes32 universalAddr) pure returns (address addr)
addr := universalAddr
}
}

/**
* Reverts with a given buffer data.
* Meant to be used to easily bubble up errors from low level calls when they fail.
*/
function reRevert(bytes memory err) pure {
assembly ("memory-safe") {
revert(add(err, 32), mload(err))
}
}

0 comments on commit 847c823

Please sign in to comment.