From d756b28611396a8b2ac2c2df05a88babf0a585b2 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 26 Nov 2009 19:32:14 +0000 Subject: [PATCH] Correct %exception documentation so no memory is leaked - bug #2903761 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11759 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Customization.html | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Doc/Manual/Customization.html b/Doc/Manual/Customization.html index ec73e5460..82e1c411f 100644 --- a/Doc/Manual/Customization.html +++ b/Doc/Manual/Customization.html @@ -53,6 +53,21 @@ The %exception directive allows you to define a general purpose excepti handler. For example, you can specify the following:

+
+%exception {
+    try {
+        $action
+    }
+    catch (RangeError) {
+        ... handle error ...
+    }
+}
+
+ +

+How the exception is handled depends on the target language, for example, Python: +

+
 %exception {
     try {
@@ -60,7 +75,7 @@ handler. For example, you can specify the following:
     }
     catch (RangeError) {
         PyErr_SetString(PyExc_IndexError,"index out-of-bounds");
-        return NULL;
+        SWIG_fail;
     }
 }