diff options
author | Romain Chantereay <rchantereau@entrouvert.com> | 2005-01-24 17:36:09 +0000 |
---|---|---|
committer | Romain Chantereay <rchantereau@entrouvert.com> | 2005-01-24 17:36:09 +0000 |
commit | 76fa5b7932c7ad0577bdfb018594560fe29db8fc (patch) | |
tree | 87b8d81cbeede6c9e5d2bebd302f6cf856a13953 /swig | |
parent | 57dabb30ef248ca4451c55186abf4d2903c4bb68 (diff) | |
download | lasso-76fa5b7932c7ad0577bdfb018594560fe29db8fc.tar.gz lasso-76fa5b7932c7ad0577bdfb018594560fe29db8fc.tar.xz lasso-76fa5b7932c7ad0577bdfb018594560fe29db8fc.zip |
Added a special section for PHP4 SWIG execeptions.
Now positive lasso errors will not produce a E_ERROR PHP error but simply a
E_WARNING PHP error.
Diffstat (limited to 'swig')
-rw-r--r-- | swig/Lasso.i | 35 |
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; |