Merge pull request #8228 from ethereum/clarifyDocsTryCatch

Some clarification about try-catch.
This commit is contained in:
chriseth 2020-02-03 14:45:05 +01:00 committed by GitHub
commit 9912f73435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -717,3 +717,13 @@ in scope in the block that follows.
in a catch block or the execution of the try/catch statement itself in a catch block or the execution of the try/catch statement itself
reverts (for example due to decoding failures as noted above or reverts (for example due to decoding failures as noted above or
due to not providing a low-level catch clause). due to not providing a low-level catch clause).
.. note::
The reason behind a failed call can be manifold. Do not assume that
the error message is coming directly from the called contract:
The error might have happened deeper down in the call chain and the
called contract just forwarded it. Also, it could be due to an
out-of-gas situation and not a deliberate error condition:
The caller always retains 63/64th of the gas in a call and thus
even if the called contract goes out of gas, the caller still
has some gas left.