aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-11 04:24:59 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-12 15:35:05 +0800
commitd6394c46a1ae8bce4e6ed52f19b26a66c3ab1428 (patch)
treee1f19a7519e8492c74ea318322d5a79506835713 /docs/control-structures.rst
parent03ef5bfd5ea989503489a55d9cbf4d212943afba (diff)
downloaddexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar.gz
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar.bz2
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar.lz
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar.xz
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.tar.zst
dexon-solidity-d6394c46a1ae8bce4e6ed52f19b26a66c3ab1428.zip
Merge two similar sections; the original survives
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index db24d5c3..6b66e55b 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -324,12 +324,14 @@ 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:
-1. If you access an array beyond its length (i.e. ``x[i]`` where ``i >= x.length``).
-2. If a function called via a message call does not finish properly (i.e. it runs out of gas or throws an exception itself).
-3. If a non-existent function on a library is called or Ether is sent to a library.
-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 a contract-creation call using the ``new`` keyword fails.
+1. If you access an array on or beyond its length (i.e. ``x[i]`` where ``i >= x.length``) or below zero.
+2. If you access a fixed-length bytes on or beyond its length, or below zero.
+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 or Ether is sent to a library.
+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.
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.