summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-10 13:00:56 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-10 13:00:56 +0200
commit27c69dd0b36e3da7b6061e597d755f5a60a0d31b (patch)
treeb8aa34d491cc46642936d5051c6ca186fe373c04
parentc6660a4ba95e2c8112ee5190a71bdfa6640eb35d (diff)
send the first line of the error message to the error list and fail a bit
more nicely and in order
-rw-r--r--apt-pkg/edsp.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 0e229e1c0..218ce9f24 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -274,10 +274,18 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progres
}
continue;
} else if (section.Exists("Error") == true) {
+ std::string msg = SubstVar(SubstVar(section.FindS("Message"), "\n .\n", "\n\n"), "\n ", "\n");
+ if (msg.empty() == true) {
+ msg = _("External solver failed without a proper error message");
+ _error->Error(msg.c_str());
+ } else
+ _error->Error("External solver failed with: %s", msg.substr(0,msg.find('\n')).c_str());
+ if (Progress != NULL)
+ Progress->Done();
std::cerr << "The solver encountered an error of type: " << section.FindS("Error") << std::endl;
std::cerr << "The following information might help you to understand what is wrong:" << std::endl;
- std::cerr << SubstVar(SubstVar(section.FindS("Message"), "\n .\n", "\n\n"), "\n ", "\n") << std::endl << std::endl;
- break;
+ std::cerr << msg << std::endl << std::endl;
+ return false;
} else if (section.Exists("Autoremove") == true)
type = "Autoremove";
else
@@ -549,7 +557,7 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache,
if (Progress != NULL)
Progress->OverallProgress(25, 100, 75, _("Execute external solver"));
if (EDSP::ReadResponse(solver_out, Cache, Progress) == false)
- return _error->Error("Reading solver response failed");
+ return false;
return true;
}