Module: sems
Branch: master
Commit: a769bcefc3f4ad7eb57fa6ee6b6605d41f92e98e
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=a769bcefc3f4ad7eb57fa6ee6b6605d41f92e98e

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Tue Mar 19 00:11:54 2013 +0100

b/f: ivr: fixed error handling when exception are generated by the python code.

---

 apps/ivr/Ivr.cpp |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/apps/ivr/Ivr.cpp b/apps/ivr/Ivr.cpp
index 74adc6e..3c93fe6 100644
--- a/apps/ivr/Ivr.cpp
+++ b/apps/ivr/Ivr.cpp
@@ -597,8 +597,12 @@ PyObject_VaCallMethod(PyObject *o, char *name, char 
*format, va_list va)
 
   func = PyObject_GetAttrString(o, name);
   if (func == NULL) {
-    PyErr_SetString(PyExc_AttributeError, name);
-    return 0;
+
+    DBG("method %s is not implemented, "
+       "trying default one (params: '%s')\n",
+       name,format);
+
+    Py_RETURN_TRUE;
   }
 
   if (!PyCallable_Check(func))
@@ -644,18 +648,10 @@ bool IvrDialog::callPyEventHandler(const char* name, 
const char* fmt, ...)
   va_end(va);
 
   if(!o) {
-
-    if(PyErr_ExceptionMatches(PyExc_AttributeError)){
-
-      DBG("method %s is not implemented, trying default one\n",name);
-      return true;
-    }
-
-    PyErr_Print();
+    if(PyErr_Occurred()) PyErr_Print();
   }
   else {
     if(o && PyBool_Check(o) && (o == Py_True)) {
-
       ret = true;
     }
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to