summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-07 15:49:51 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-07 15:49:51 +0200
commitebfeeaedf5bc357170cae971c0f6a1458ff65f65 (patch)
tree1d3fe0af5e10c237361affc3594c2e59de27c5fe /apt-pkg
parent3d17b9ffc7c5a417d69916c282f4756cc7e938d2 (diff)
implement correct error reporting
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/edsp.cc14
-rw-r--r--apt-pkg/edsp.h7
2 files changed, 18 insertions, 3 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index d604110ef..7ece92d2e 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -256,6 +256,11 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache) {
else
std::clog << msg << std::endl;
continue;
+ } else if (section.Exists("Error") == true) {
+ 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;
} else if (section.Exists("Autoremove") == true)
type = "Autoremove";
else
@@ -457,8 +462,13 @@ bool EDSP::WriteProgress(unsigned short const percent, const char* const message
return true;
}
/*}}}*/
-bool EDSP::WriteError(std::string const &message, FILE* output) { return false; }
-
+// EDSP::WriteError - format an error message to be send to file descriptor /*{{{*/
+bool EDSP::WriteError(char const * const uuid, std::string const &message, FILE* output) {
+ fprintf(output, "Error: %s\n", uuid);
+ fprintf(output, "Message: %s\n\n", SubstVar(SubstVar(message, "\n\n", "\n.\n"), "\n", "\n ").c_str());
+ return true;
+}
+ /*}}}*/
// EDSP::ExecuteSolver - fork requested solver and setup ipc pipes {{{*/
bool EDSP::ExecuteSolver(const char* const solver, int *solver_in, int *solver_out) {
std::vector<std::string> const solverDirs = _config->FindVector("Dir::Bin::Solvers");
diff --git a/apt-pkg/edsp.h b/apt-pkg/edsp.h
index 98a70d7f6..210188d03 100644
--- a/apt-pkg/edsp.h
+++ b/apt-pkg/edsp.h
@@ -171,8 +171,13 @@ public:
*
* The first line of the message should be a short description
* of the error so it can be used for dialog titles or alike
+ *
+ * \param uuid of this error message
+ * \param message is free form text to discribe the error
+ * \param output the front-end listens for error messages
*/
- bool static WriteError(std::string const &message, FILE* output);
+ bool static WriteError(char const * const uuid, std::string const &message, FILE* output);
+
/** \brief executes the given solver and returns the pipe ends
*