I have been looking into some edge cases around Solidity try/catch.
The main point is that try/catch only catches failures from the external call or contract creation expression itself. Some failures around that expression can still revert the caller and bypass the catch block entirely.
A few examples:
-
Reverts inside the external call can be caught.
-
Panic errors such as
assertfailures or arithmetic errors inside the external call can be caught withcatch Panic(uint256). -
Custom errors and unknown revert data can be handled with
catch (bytes memory). -
Errors while evaluating arguments before the call are not caught.
-
Errors while decoding return data may bypass the
catchblock. -
Calls to addresses without contract code can behave differently than people expect because Solidity inserts checks before high-level external calls.
This matters when contracts use try/catch for “safe” integrations with unknown or optional external contracts. The catch block may not be a complete safety net unless the call boundary and ABI assumptions are handled carefully.
Curious if others here have run into try/catch edge cases in audits or production code.