aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-13 18:12:40 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-13 18:12:40 +0800
commitff0f44352efa79fb99db7cb43e552d33e9deaf3d (patch)
treeb0edd3d4f75a1cd59d3d7b64255f01b20219d60f /docs/control-structures.rst
parentf49238068861517fe4b520fd9fc78acf58894ca2 (diff)
downloaddexon-solidity-ff0f44352efa79fb99db7cb43e552d33e9deaf3d.tar.gz
dexon-solidity-ff0f44352efa79fb99db7cb43e552d33e9deaf3d.tar.zst
dexon-solidity-ff0f44352efa79fb99db7cb43e552d33e9deaf3d.zip
Accommodating reviews
https://github.com/ethereum/solidity/pull/1167#pullrequestreview-4031601
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst17
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 56c422e9..a19baa23 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -322,17 +322,16 @@ In the following example, we show how ``throw`` can be used to easily revert an
}
}
-Currently, there are six situations, where exceptions happen automatically in Solidity:
+Currently, there are situations, where exceptions happen automatically in Solidity:
1. If you access an array on a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
-2. If you access a fixed-length ``bytes`` on a too large or negative index.
-3. If a function called via a message call does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used.
-4. If a non-existent function on a library is called
-5. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
-6. If you perform an external function call targeting a contract that contains no code.
-7. If a contract-creation call using the ``new`` keyword does not finish properly.
-8. If a contract is called but there are no matching interface or fallback function.
-9. If Ether is sent to a contract interface function without ``payable`` modifier (including the constructor and the fallback function)
+2. If you access a fixed-length ``bytesN`` on a too large or negative index.
+3. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by return values being ``false``.
+4. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
+5. If you perform an external function call targeting a contract that contains no code.
+6. If you call a contract-creation using the ``new`` keyword but it does not finish properly.
+7. If your contract receives Ether on a public function without ``payable`` modifier (including the constructor and the fallback function).
+8. If your contract receives Ether on a public variable access.
Internally, Solidity performs an "invalid jump" when an exception is thrown and thus causes the EVM to revert all changes made to the state. The reason for this is that there is no safe way to continue execution, because an expected effect did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction (or at least call) without effect.