diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-01-21 21:43:34 +0100 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-01-22 00:24:43 +0100 |
commit | acc394ca239b1a1ae864017c22aae8660b655053 (patch) | |
tree | 8e9ccb3f897a34f03c14d28e6762f7445203d3dc /doc/tut2.txt | |
parent | d0bd5d5cc3407e14ff37590077ec40441be26c84 (diff) | |
download | Nim-acc394ca239b1a1ae864017c22aae8660b655053.tar.gz |
Adds some documentation related to exceptions.
Diffstat (limited to 'doc/tut2.txt')
-rwxr-xr-x | doc/tut2.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/tut2.txt b/doc/tut2.txt index 9f9dbe2db..4a4ef1757 100755 --- a/doc/tut2.txt +++ b/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 ------------------- |