---------------------- PyUtilGetPyErrorInfo ---------------------- Get the error and name of an item that has generated PyError.
| 108 | // Get the error and name of an item that has generated PyError. |
| 109 | // |
| 110 | void PyUtilGetPyErrorInfo(PyObject* item, std::string& errorMsg, std::string& itemStr) |
| 111 | { |
| 112 | PyObject *ptype, *pvalue, *ptraceback; |
| 113 | PyErr_Fetch(&ptype, &pvalue, &ptraceback); |
| 114 | auto pystr = PyObject_Str(pvalue); |
| 115 | errorMsg = std::string(PyString_AsString(pystr)); |
| 116 | auto itemRep = PyObject_Repr(item); |
| 117 | itemStr = std::string(PyString_AsString(itemRep)); |
| 118 | } |
| 119 | |
| 120 | //-------------------------- |
| 121 | // SvPyUtilGetFunctionName |
no outgoing calls
no test coverage detected