summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Util.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-10-07 21:57:47 +0000
committerMark Spruiell <mes@zeroc.com>2004-10-07 21:57:47 +0000
commit38fd567a73c0489804513de3bc185f76e03bef11 (patch)
treed87c9e19dcb5e2897220af7a74ac7b7e53775f76 /py/modules/IcePy/Util.cpp
parentfixing clean target (diff)
downloadice-38fd567a73c0489804513de3bc185f76e03bef11.tar.bz2
ice-38fd567a73c0489804513de3bc185f76e03bef11.tar.xz
ice-38fd567a73c0489804513de3bc185f76e03bef11.zip
show more information about a python exception
Diffstat (limited to 'py/modules/IcePy/Util.cpp')
-rw-r--r--py/modules/IcePy/Util.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/py/modules/IcePy/Util.cpp b/py/modules/IcePy/Util.cpp
index 49efd0e6a56..3df452a7784 100644
--- a/py/modules/IcePy/Util.cpp
+++ b/py/modules/IcePy/Util.cpp
@@ -592,12 +592,22 @@ IcePy::throwPythonException(PyObject* ex)
}
else
{
+ ostringstream ostr;
+
PyObject* cls = (PyObject*)((PyInstanceObject*)ex)->in_class;
- IcePy::PyObjectHandle str = PyObject_Str(cls);
- assert(str.get() != NULL);
+ IcePy::PyObjectHandle className = PyObject_Str(cls);
+ assert(className.get() != NULL);
+
+ ostr << PyString_AsString(className.get());
+
+ IcePy::PyObjectHandle msg = PyObject_Str(ex);
+ if(msg.get() != NULL && strlen(PyString_AsString(msg.get())) > 0)
+ {
+ ostr << ": " << PyString_AsString(msg.get());
+ }
Ice::UnknownException e(__FILE__, __LINE__);
- e.unknown = PyString_AsString(str.get());
+ e.unknown = ostr.str();
throw e;
}
}