diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-04 16:23:04 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-04 16:23:04 +0000 |
| commit | 7bfd7d61999da691dd03411132ad883b7f3f906b (patch) | |
| tree | d9101b396101d938ffbae010dbe762897625c0e8 /python/generic.cc | |
| parent | 22b6039107124d9e2fb9f3185d1663fac482f25e (diff) | |
| download | python-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.cc | 17 |
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; } |
