fix handling of feed update exceptions
This commit is contained in:
parent
01cbd8f3c6
commit
04a493b7ba
@ -308,15 +308,24 @@ void FeedDownloader::updateOneFeed(Feed* feed) {
|
||||
}
|
||||
}
|
||||
catch (const FeedFetchException& feed_ex) {
|
||||
// TODO: logovat chybu, todo datachanged feed
|
||||
qCriticalNN << LOGSEC_NETWORK
|
||||
<< "Error when fetching feed:"
|
||||
<< QUOTE_W_SPACE(feed_ex.feedStatus())
|
||||
<< "message:"
|
||||
<< QUOTE_W_SPACE_DOT(feed_ex.message());
|
||||
|
||||
feed->setStatus(feed_ex.feedStatus());
|
||||
feed->getParentServiceRoot()->itemChanged({ feed });
|
||||
}
|
||||
|
||||
catch (const ApplicationException& app_ex) {
|
||||
// TODO: logovat chybu, todo datachanged feed
|
||||
qCriticalNN << LOGSEC_NETWORK
|
||||
<< "Unknown error when fetching feed:"
|
||||
<< "message:"
|
||||
<< QUOTE_W_SPACE_DOT(app_ex.message());
|
||||
|
||||
feed->setStatus(Feed::Status::OtherError);
|
||||
feed->getParentServiceRoot()->itemChanged({ feed });
|
||||
}
|
||||
|
||||
m_feedsUpdated++;
|
||||
|
@ -423,9 +423,6 @@ void FormMessageFiltersManager::processCheckedFeeds() {
|
||||
|
||||
// Update messages in DB and reload selection.
|
||||
it->toFeed()->updateMessages(msgs, true);
|
||||
|
||||
// TODO: ted hazi vyjimku, ošetřit
|
||||
|
||||
displayMessagesOfFeed();
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void FeedReader::updateAllFeeds() {
|
||||
}
|
||||
|
||||
void FeedReader::updateManuallyIntervaledFeeds() {
|
||||
updateFeeds(m_feedsModel->rootItem()->getSubTreeManuallyIntervaledFeeds());
|
||||
updateFeeds(m_feedsModel->rootItem()->getSubTreeAutoFetchingWithManualIntervalsFeeds());
|
||||
}
|
||||
|
||||
void FeedReader::stopRunningFeedUpdate() {
|
||||
|
@ -192,6 +192,7 @@ QPair<int, int> Feed::updateMessages(const QList<Message>& messages, bool force_
|
||||
QPair<int, int> updated_messages = { 0, 0 };
|
||||
|
||||
if (messages.isEmpty()) {
|
||||
qDebugNN << "No messages to be updated/added in DB.";
|
||||
return updated_messages;
|
||||
}
|
||||
|
||||
@ -203,20 +204,19 @@ QPair<int, int> Feed::updateMessages(const QList<Message>& messages, bool force_
|
||||
<< QUOTE_W_SPACE_DOT(is_main_thread);
|
||||
|
||||
bool ok = false;
|
||||
|
||||
qDebugNN << LOGSEC_CORE
|
||||
<< "There are some messages to be updated/added to DB.";
|
||||
|
||||
QString custom_id = customId();
|
||||
int account_id = getParentServiceRoot()->accountId();
|
||||
QSqlDatabase database = is_main_thread ?
|
||||
qApp->database()->driver()->connection(metaObject()->className()) :
|
||||
qApp->database()->driver()->connection(QSL("feed_upd"));
|
||||
|
||||
updated_messages = DatabaseQueries::updateMessages(database, messages, custom_id, account_id,
|
||||
source(), force_update, &ok);
|
||||
updated_messages = DatabaseQueries::updateMessages(database, messages,
|
||||
custom_id, account_id,
|
||||
source(), force_update,
|
||||
&ok);
|
||||
|
||||
if (ok && (updated_messages.first > 0 || updated_messages.second > 0)) {
|
||||
if (updated_messages.first > 0 || updated_messages.second > 0) {
|
||||
// Something was added or updated in the DB, update numbers.
|
||||
updateCounts(true);
|
||||
|
||||
if (getParentServiceRoot()->recycleBin() != nullptr) {
|
||||
|
@ -36,6 +36,8 @@ class Feed : public RootItem {
|
||||
OtherError = 5
|
||||
};
|
||||
|
||||
Q_ENUM(Status)
|
||||
|
||||
explicit Feed(RootItem* parent = nullptr);
|
||||
explicit Feed(const Feed& other);
|
||||
explicit Feed(const QString& title, const QString& custom_id, const QIcon& icon, RootItem* parent = nullptr);
|
||||
|
@ -400,7 +400,7 @@ QList<Feed*> RootItem::getSubTreeFeeds() const {
|
||||
return children;
|
||||
}
|
||||
|
||||
QList<Feed*> RootItem::getSubTreeManuallyIntervaledFeeds() const {
|
||||
QList<Feed*> RootItem::getSubTreeAutoFetchingWithManualIntervalsFeeds() const {
|
||||
QList<Feed*> children;
|
||||
QList<RootItem*> traversable_items;
|
||||
|
||||
|
@ -143,7 +143,7 @@ class RSSGUARD_DLLSPEC RootItem : public QObject {
|
||||
// Returns list of feeds complemented by their own string CUSTOM ID.
|
||||
QHash<QString, Feed*> getHashedSubTreeFeeds() const;
|
||||
QList<Feed*> getSubTreeFeeds() const;
|
||||
QList<Feed*> getSubTreeManuallyIntervaledFeeds() const;
|
||||
QList<Feed*> getSubTreeAutoFetchingWithManualIntervalsFeeds() const;
|
||||
QList<Feed*> getSubAutoFetchingEnabledFeeds() const;
|
||||
|
||||
// Returns the service root node which is direct or indirect parent of current item.
|
||||
|
Loading…
x
Reference in New Issue
Block a user