aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-12 16:57:35 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-12 16:59:22 +0800
commitf49238068861517fe4b520fd9fc78acf58894ca2 (patch)
tree3b63f217bb6e2e78db326732a31796a9f9492675 /docs/control-structures.rst
parent246d91438fcd3f2fe07dab64d2a1ef1c1d01fa61 (diff)
downloaddexon-solidity-f49238068861517fe4b520fd9fc78acf58894ca2.tar.gz
dexon-solidity-f49238068861517fe4b520fd9fc78acf58894ca2.tar.zst
dexon-solidity-f49238068861517fe4b520fd9fc78acf58894ca2.zip
Mention `payable` in the description when Solidity throws
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst3
1 files changed, 2 insertions, 1 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index fa983d87..56c422e9 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -327,11 +327,12 @@ Currently, there are six situations, where exceptions happen automatically in So
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 or Ether is sent to a library.
+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)
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.