summaryrefslogtreecommitdiff
path: root/python/generic.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-08-04 16:23:04 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-08-04 16:23:04 +0000
commit7bfd7d61999da691dd03411132ad883b7f3f906b (patch)
treed9101b396101d938ffbae010dbe762897625c0e8 /python/generic.cc
parent22b6039107124d9e2fb9f3185d1663fac482f25e (diff)
downloadpython-apt-7bfd7d61999da691dd03411132ad883b7f3f906b.tar.gz
* applied a patch from Chris Halls to return the apt error string on a system error exception (thanks chris!)
Diffstat (limited to 'python/generic.cc')
-rw-r--r--python/generic.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/python/generic.cc b/python/generic.cc
index 1d6a91af..044569b9 100644
--- a/python/generic.cc
+++ b/python/generic.cc
@@ -28,15 +28,20 @@ PyObject *HandleErrors(PyObject *Res)
if (Res != 0)
Py_DECREF(Res);
- string Err = "Internal Error Error";
+ string Err;
+ int errcnt = 0;
while (_error->empty() == false)
{
- bool Type = _error->PopMessage(Err);
- if (Type == false)
- continue;
+ string Msg;
+ bool Type = _error->PopMessage(Msg);
+ if (errcnt > 0)
+ Err.append(", ");
+ Err.append((Type == true ? "E:" : "W:"));
+ Err.append(Msg);
+ ++errcnt;
}
-
- _error->Discard();
+ if (errcnt == 0)
+ Err = "Internal Error";
PyErr_SetString(PyExc_SystemError,Err.c_str());
return 0;
}