tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajbor...@apache.org
Subject svn commit: r512711 - /incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
Date Wed, 28 Feb 2007 11:26:22 GMT
Author: ajborley
Date: Wed Feb 28 03:26:22 2007
New Revision: 512711

URL: http://svn.apache.org/viewvc?view=rev&rev=512711
Log:
Improved Python error messages: now logs errors raised inside scripts

Modified:
    incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp

Modified: incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp?view=diff&rev=512711&r1=512710&r2=512711
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
(original)
+++ incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
Wed Feb 28 03:26:22 2007
@@ -867,9 +867,30 @@
                             Py_XDECREF(elementTreeModule);
                             Py_XDECREF(elementTreeModuleName);
 
-                            string msg = "Error whilst calling Python function "+operation.getName();
+                            string msg = "Error whilst calling Python function "+operation.getName()+":
";
                             if(PyErr_Occurred())
                             {
+                                PyObject *pErrorType, *pErrorValue, *pErrorTraceback;
+                                PyErr_Fetch(&pErrorType, &pErrorValue, &pErrorTraceback);
+ 
+                                if (pErrorType != NULL && pErrorValue != NULL)
+                                {
+                                    PyObject* pErrorTypeStr = PyObject_Str(pErrorType); 
  
+                                    PyObject* pErrorValueStr = PyObject_Str(pErrorValue);
   
+                                    msg += PyString_AsString(pErrorTypeStr);
+                                    msg += " : ";
+                                    msg += PyString_AsString(pErrorValueStr);
+                                    Py_DECREF(pErrorTypeStr);
+                                    Py_DECREF(pErrorValueStr);                          
         
+                                }
+                                else
+                                {
+                                    msg += "No Python Error information provided";      
                             
+                                }
+                                Py_XDECREF(pErrorType);
+                                Py_XDECREF(pErrorValue);         
+                                Py_XDECREF(pErrorTraceback);    
+
                                 PyErr_Print();
                             }
                             



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message