From 7bfd7d61999da691dd03411132ad883b7f3f906b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 4 Aug 2005 16:23:04 +0000 Subject: * applied a patch from Chris Halls to return the apt error string on a system error exception (thanks chris!) --- apt/progress.py | 1 + python/generic.cc | 17 +++++++++++------ 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; } -- cgit v1.2.3