aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-08-19 00:47:41 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-08-19 00:47:41 +0800
commitbbe7c493adaf7b1d37310ad3d18e2a716f3b6713 (patch)
treef5610fef63126fed3d2c49b251c45aa1701ce4c4 /docs/control-structures.rst
parentc2cfc819a20292f6085a8583336ed88fd70cb98b (diff)
downloaddexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar.gz
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar.bz2
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar.lz
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar.xz
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.tar.zst
dexon-solidity-bbe7c493adaf7b1d37310ad3d18e2a716f3b6713.zip
Document throwing on contract-creation fail
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 f4991520..73b0131f 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -299,13 +299,14 @@ In the following example, we show how ``throw`` can be used to easily revert an
}
}
-Currently, there are five situations, where exceptions happen automatically in Solidity:
+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.
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.