Adds some documentation related to exceptions.
This commit is contained in:
parent
d0bd5d5cc3
commit
acc394ca23
2 changed files with 31 additions and 0 deletions
14
doc/tut2.txt
14
doc/tut2.txt
|
|
@ -433,6 +433,20 @@ handled, it is propagated through the call stack. This means that often
|
|||
the rest of the procedure - that is not within a ``finally`` clause -
|
||||
is not executed (if an exception occurs).
|
||||
|
||||
If you need to *access* the actual exception object or message inside an
|
||||
``except`` branch you can use the getCurrentException() and
|
||||
getCurrentExceptionMsg() procs from the `system <system.html>`_ module.
|
||||
Example:
|
||||
|
||||
.. code-block:: nimrod
|
||||
try:
|
||||
doSomethingHere()
|
||||
except:
|
||||
let
|
||||
e = getCurrentException()
|
||||
msg = getCurrentExceptionMsg()
|
||||
echo "Got exception ", repr(e), " with message ", msg
|
||||
|
||||
|
||||
Exception hierarchy
|
||||
-------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue