diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html index 49272c1ea..ce66d08e1 100644 --- a/Doc/Manual/Scilab.html +++ b/Doc/Manual/Scilab.html @@ -35,6 +35,7 @@
-Templates are supported. See the SWIG general documentation on how templates are interfaced in SWIG.
-An example of templates can be found in Examples/scilab/templates.
-
@@ -1136,7 +1132,86 @@ private:
-+Scilab does not natively support exceptions, but has errors. +When an exception is thrown, SWIG catches it, sets a Scilab error. An error message is displayed in Scilab. +For example: +
+ +
+%module example
+
+%inline %{
+void throw_exception() throw(char const*) {
+ throw "Bye world !";
+}
+%}
++
+-->throw_exception() + !--error 999 +Exception (char const *) occured: Bye world ! +
+Scilab has a try-catch mechanism (and a similar instruction execstr()) to handle exceptions. +It can be used with the lasterror() function as following: +
+ ++
+-->execstr('throw_exception()', 'errcatch');
+ ans =
+
+ 999.
+
+-->lasterror()
+ ans =
+
+ Exception (char const *) occured: Bye world !
++If the function has a throw exception speficication, SWIG can map automatically the exception type and set an appropriate Scilab error message. +It works for exception basic types, like char* in the previous example or another example, int: +
+ +
+%module example
+
+%inline %{
+void throw_int() throw(int) {
+ throw 12;
+}
+%}
++
+-->execstr('throw_int()', 'errcatch');
+ ans =
+
+ 999.
+
+-->lasterror()
+ ans =
+
+ Exception (int) occured: 12.
++With a more complex or custom exception type, you will have to implement a specific exception typemap to handle specifically this exception type. +See the SWIG C++ documentation for more details. +
+ +
The Standard Template Library (STL) is partially supported. See STL for more details.