aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-01-23 16:32:37 +0800
committerGitHub <noreply@github.com>2017-01-23 16:32:37 +0800
commit7e2e1eb94ff0662e4a8bd5a71d77aed9f9bb53ca (patch)
tree609e6c2021cc6ef1775714e7e5a6950001f84638 /docs/control-structures.rst
parent6946902cb5093ce26e36b6fe2022e8c44722348f (diff)
parent7ecc8e412d98ceac16cd36d87c9f3def2584cac3 (diff)
downloaddexon-solidity-7e2e1eb94ff0662e4a8bd5a71d77aed9f9bb53ca.tar.gz
dexon-solidity-7e2e1eb94ff0662e4a8bd5a71d77aed9f9bb53ca.tar.zst
dexon-solidity-7e2e1eb94ff0662e4a8bd5a71d77aed9f9bb53ca.zip
Merge pull request #1597 from sarbogast/patch-2
Fix the list of reasons for throwing automatically
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst20
1 files changed, 10 insertions, 10 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 532dab0c..3f012b12 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -384,16 +384,16 @@ In the following example, we show how ``throw`` can be used to easily revert an
Currently, Solidity automatically generates a runtime exception in the following situations:
-1. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
-1. If you access a fixed-length ``bytesN`` at a too large or negative index.
-1. 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 returning ``false``.
-1. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
-1. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
-1. If you shift by a negative amount.
-1. If you convert a value too big or negative into an enum type.
-1. If you perform an external function call targeting a contract that contains no code.
-1. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
-1. If your contract receives Ether via a public accessor function.
+#. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
+#. If you access a fixed-length ``bytesN`` at a too large or negative index.
+#. 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 returning ``false``.
+#. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
+#. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
+#. If you shift by a negative amount.
+#. If you convert a value too big or negative into an enum type.
+#. If you perform an external function call targeting a contract that contains no code.
+#. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
+#. If your contract receives Ether via a public accessor 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.