Fixed non-working examples in Manual: Exception Handling (#13424)
This commit is contained in:
parent
87dd19453b
commit
479f4ca6a3
1 changed files with 3 additions and 1 deletions
|
|
@ -4106,6 +4106,8 @@ needs to fit the types of ``except`` branches, but the type of the ``finally``
|
|||
branch always has to be ``void``:
|
||||
|
||||
.. code-block:: nim
|
||||
from strutils import parseInt
|
||||
|
||||
let x = try: parseInt("133a")
|
||||
except: -1
|
||||
finally: echo "hi"
|
||||
|
|
@ -4220,7 +4222,7 @@ Raise statement
|
|||
Example:
|
||||
|
||||
.. code-block:: nim
|
||||
raise newEOS("operating system failed")
|
||||
raise newException(IOError, "IO failed")
|
||||
|
||||
Apart from built-in operations like array indexing, memory allocation, etc.
|
||||
the ``raise`` statement is the only way to raise an exception.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue