mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 19:22:40 +00:00
Fixed non-working examples in Manual: Exception Handling (#13424)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user