better error texts, report errors correctly for standard and tt-rss, more to come later

This commit is contained in:
Martin Rotter 2021-06-28 14:06:11 +02:00
parent 22c24fe988
commit 42f164792a
3 changed files with 17 additions and 4 deletions

View File

@ -293,8 +293,11 @@ QString Feed::getStatusDescription() const {
case Status::NetworkError:
return tr("network error");
case Status::ParsingError:
return tr("parsing error");
default:
return tr("unspecified error");
return tr("error");
}
}
@ -319,9 +322,15 @@ void Feed::removeMessageFilter(MessageFilter* filter) {
}
QString Feed::additionalTooltip() const {
QString stat = getStatusDescription();
if (!m_statusString.simplified().isEmpty()) {
stat += QSL(" (%1)").arg(m_statusString);
}
return tr("Auto-update status: %1\n"
"Active message filters: %2\n"
"Status: %3").arg(getAutoUpdateStatusDescription(),
QString::number(m_messageFilters.size()),
getStatusDescription());
stat);
}

View File

@ -9,7 +9,11 @@
#include <utility>
FeedParser::FeedParser(QString data) : m_xmlData(std::move(data)), m_mrssNamespace(QSL("http://search.yahoo.com/mrss/")) {
m_xml.setContent(m_xmlData, true);
QString error;
if (!m_xml.setContent(m_xmlData, true, &error)) {
throw ApplicationException(QObject::tr("XML problem: %1").arg(error));
}
}
FeedParser::~FeedParser() = default;

View File

@ -229,7 +229,7 @@ QList<Message> TtRssServiceRoot::obtainNewMessages(const QList<Feed*>& feeds) {
networkProxy());
if (network()->lastError() != QNetworkReply::NetworkError::NoError) {
throw FeedFetchException(Feed::Status::NetworkError);
throw FeedFetchException(Feed::Status::NetworkError, headlines.error());
}
else {
QList<Message> new_messages = headlines.messages(this);