commit 49c8a5c272c9db4a59fa7c14adebdde520298889
parent f7c1d3a4f1ce4c05413980563d85dfb50ae704a4
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 7 Dec 2015 21:53:36 -0500
move the error message formatting responsability over to the dialog
Diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/report.cpp b/src/report.cpp
@@ -89,6 +89,6 @@ void Report::formatErrors(ostringstream &text)
{
text << NL << SEP << " Errors: " << SEP << NL;
- for(const string &msg : m_transaction->errors())
- text << NL << "- " << msg << NL;
+ for(const Transaction::Error &err : m_transaction->errors())
+ text << NL << err.title << ":" << NL << err.message << NL;
}
diff --git a/src/transaction.cpp b/src/transaction.cpp
@@ -161,5 +161,5 @@ void Transaction::finish()
void Transaction::addError(const string &message, const string &title)
{
- m_errors.push_back(title + ":\n" + message);
+ m_errors.push_back({message, title});
}
diff --git a/src/transaction.hpp b/src/transaction.hpp
@@ -9,8 +9,6 @@
#include <boost/signals2.hpp>
-typedef std::vector<std::string> ErrorList;
-
class Transaction {
public:
typedef boost::signals2::signal<void ()> Signal;
@@ -19,6 +17,14 @@ public:
typedef std::pair<Package *, const Registry::QueryResult> PackageEntry;
typedef std::vector<PackageEntry> PackageEntryList;
+ struct Error {
+ std::string message;
+ std::string title;
+ };
+
+ typedef std::vector<const Error> ErrorList;
+
+
Transaction(Registry *reg, const Path &root);
~Transaction();