summaryrefslogtreecommitdiff
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
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!)
-rw-r--r--apt/progress.py1
-rw-r--r--python/generic.cc17
2 files changed, 12 insertions, 6 deletions
diff --git a/apt/progress.py b/apt/progress.py
index 70696b6b..6fd2977a 100644
--- a/apt/progress.py
+++ b/apt/progress.py
@@ -61,6 +61,7 @@ class FetchProgress:
pass
def pulse(self):
+ """ called periodically (to update the gui) """
return True
def mediaChange(self, medium, drive):
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;
}