From acc394ca239b1a1ae864017c22aae8660b655053 Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Mon, 21 Jan 2013 21:43:34 +0100 Subject: Adds some documentation related to exceptions. --- doc/tut2.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'doc/tut2.txt') 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 `_ module. +Example: + +.. code-block:: nimrod + try: + doSomethingHere() + except: + let + e = getCurrentException() + msg = getCurrentExceptionMsg() + echo "Got exception ", repr(e), " with message ", msg + Exception hierarchy ------------------- -- cgit 1.4.1-2-gfad0