summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-method.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-method.cc')
-rw-r--r--apt-pkg/acquire-method.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc
index 9656caf14..486098c77 100644
--- a/apt-pkg/acquire-method.cc
+++ b/apt-pkg/acquire-method.cc
@@ -139,27 +139,30 @@ void pkgAcqMethod::SendMessage(std::string const &header, std::unordered_map<std
/* */
void pkgAcqMethod::Fail(bool Transient)
{
- string Err = "Undetermined Error";
- if (_error->empty() == false)
+
+ Fail("", Transient);
+}
+ /*}}}*/
+// AcqMethod::Fail - A fetch has failed /*{{{*/
+void pkgAcqMethod::Fail(string Err, bool Transient)
+{
+
+ if (not _error->empty())
{
- Err.clear();
- while (_error->empty() == false)
+ while (not _error->empty())
{
std::string msg;
if (_error->PopMessage(msg))
{
- if (Err.empty() == false)
+ if (not Err.empty())
Err.append("\n");
Err.append(msg);
}
}
}
- Fail(Err, Transient);
-}
- /*}}}*/
-// AcqMethod::Fail - A fetch has failed /*{{{*/
-void pkgAcqMethod::Fail(string Err,bool Transient)
-{
+ if (Err.empty())
+ Err = "Undetermined Error";
+
// Strip out junk from the error messages
std::transform(Err.begin(), Err.end(), Err.begin(), [](char const c) {
if (c == '\r' || c == '\n')