summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--swig/Lasso.i35
1 files changed, 33 insertions, 2 deletions
diff --git a/swig/Lasso.i b/swig/Lasso.i
index 662a78b6..a0898a06 100644
--- a/swig/Lasso.i
+++ b/swig/Lasso.i
@@ -219,6 +219,37 @@ Warning = _lasso.Warning
#else
+#ifdef SWIGPHP4
+%{
+
+static void throw_exception_msg(int errorCode) {
+ char errorMsg[256];
+ if (errorCode > 0)
+ {
+ sprintf(errorMsg, "%d / Lasso Warning", errorCode);
+ zend_error(E_WARNING, errorMsg);
+ }
+ else
+ {
+ sprintf(errorMsg, "%d / Lasso Error", errorCode);
+ zend_error(E_ERROR, errorMsg);
+ }
+}
+
+%}
+
+%define THROW_ERROR
+%exception {
+ int errorCode;
+ errorCode = $action
+ if (errorCode) {
+ throw_exception_msg(errorCode);
+ }
+}
+%enddef
+
+#else /* If SWIGPHP4 and SWIGPYTHON not defined.*/
+
%{
static void build_exception_msg(int errorCode, char *errorMsg) {
@@ -241,8 +272,8 @@ static void build_exception_msg(int errorCode, char *errorMsg) {
}
}
%enddef
-
-#endif
+#endif /* Ifdef SWIGPHP4. */
+#endif /* Ifdef SWIGPYTHON.*/
%define END_THROW_ERROR
%exception;