Remove some errors logging while closing.

GitOrigin-RevId: 65e4ca3d0748b4d59511d9024e2eff1367e13cf7
This commit is contained in:
levlam 2019-02-14 18:36:16 +03:00
parent ab2c23c220
commit ec692e98e4
5 changed files with 77 additions and 25 deletions

View File

@ -58,7 +58,9 @@ class GetSavedGifsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for get saved animations: " << status; LOG(ERROR) << "Receive error for get saved animations: " << status;
}
td->animations_manager_->on_get_saved_animations_failed(is_repair_, std::move(status)); td->animations_manager_->on_get_saved_animations_failed(is_repair_, std::move(status));
} }
}; };
@ -116,7 +118,9 @@ class SaveGifQuery : public Td::ResultHandler {
return; return;
} }
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for save GIF: " << status; LOG(ERROR) << "Receive error for save GIF: " << status;
}
td->animations_manager_->reload_saved_animations(true); td->animations_manager_->reload_saved_animations(true);
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }

View File

@ -334,7 +334,9 @@ class BlockUserQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(WARNING) << "Receive error for blockUser: " << status; LOG(WARNING) << "Receive error for blockUser: " << status;
}
status.ignore(); status.ignore();
} }
}; };
@ -356,7 +358,9 @@ class UnblockUserQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(WARNING) << "Receive error for unblockUser: " << status; LOG(WARNING) << "Receive error for unblockUser: " << status;
}
status.ignore(); status.ignore();
} }
}; };
@ -461,8 +465,10 @@ class GetContactsStatusesQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for getContactsStatuses: " << status; LOG(ERROR) << "Receive error for getContactsStatuses: " << status;
} }
}
}; };
class ImportContactsQuery : public Td::ResultHandler { class ImportContactsQuery : public Td::ResultHandler {
@ -7239,6 +7245,9 @@ bool ContactsManager::on_get_channel_error(ChannelId channel_id, const Status &s
LOG(ERROR) << "Receive BOT_METHOD_INVALID from " << source; LOG(ERROR) << "Receive BOT_METHOD_INVALID from " << source;
return true; return true;
} }
if (G()->close_flag()) {
return true;
}
if (status.message() == "CHANNEL_PRIVATE" || status.message() == "CHANNEL_PUBLIC_GROUP_NA") { if (status.message() == "CHANNEL_PRIVATE" || status.message() == "CHANNEL_PUBLIC_GROUP_NA") {
if (!channel_id.is_valid()) { if (!channel_id.is_valid()) {
LOG(ERROR) << "Receive " << status.message() << " in invalid " << channel_id << " from " << source; LOG(ERROR) << "Receive " << status.message() << " in invalid " << channel_id << " from " << source;

View File

@ -181,7 +181,9 @@ class GetDialogUnreadMarksQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for GetDialogUnreadMarksQuery: " << status; LOG(ERROR) << "Receive error for GetDialogUnreadMarksQuery: " << status;
}
status.ignore(); status.ignore();
} }
}; };
@ -439,7 +441,9 @@ class SearchPublicDialogsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for SearchPublicDialogsQuery: " << status; LOG(ERROR) << "Receive error for SearchPublicDialogsQuery: " << status;
}
td->messages_manager_->on_failed_public_dialogs_search(query_, std::move(status)); td->messages_manager_->on_failed_public_dialogs_search(query_, std::move(status));
} }
}; };
@ -801,7 +805,9 @@ class ClearAllDraftsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for ClearAllDraftsQuery: " << status; LOG(ERROR) << "Receive error for ClearAllDraftsQuery: " << status;
}
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
}; };
@ -884,7 +890,9 @@ class ReorderPinnedDialogsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for ReorderPinnedDialogsQuery: " << status; LOG(ERROR) << "Receive error for ReorderPinnedDialogsQuery: " << status;
}
td->messages_manager_->on_update_pinned_dialogs(); td->messages_manager_->on_update_pinned_dialogs();
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
@ -1017,7 +1025,9 @@ class ReadMessagesContentsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for read message contents: " << status; LOG(ERROR) << "Receive error for read message contents: " << status;
}
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
}; };
@ -2143,7 +2153,7 @@ class UploadMediaQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
LOG(WARNING) << "Receive error for uploadMedia: " << status; LOG(INFO) << "Receive error for uploadMedia: " << status;
if (G()->close_flag() && G()->parameters().use_message_db) { if (G()->close_flag() && G()->parameters().use_message_db) {
// do not send error, message will be re-sent // do not send error, message will be re-sent
return; return;
@ -2742,7 +2752,9 @@ class DeleteMessagesQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for delete messages: " << status; LOG(ERROR) << "Receive error for delete messages: " << status;
}
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
}; };
@ -3003,7 +3015,9 @@ class ResetNotifySettingsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for reset notification settings: " << status; LOG(ERROR) << "Receive error for reset notification settings: " << status;
}
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
}; };
@ -17669,6 +17683,9 @@ bool MessagesManager::on_get_dialog_error(DialogId dialog_id, const Status &stat
LOG(ERROR) << "Receive BOT_METHOD_INVALID from " << source; LOG(ERROR) << "Receive BOT_METHOD_INVALID from " << source;
return true; return true;
} }
if (G()->close_flag()) {
return true;
}
switch (dialog_id.get_type()) { switch (dialog_id.get_type()) {
case DialogType::User: case DialogType::User:

View File

@ -76,7 +76,9 @@ class GetAllStickersQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for get all stickers: " << status; LOG(ERROR) << "Receive error for get all stickers: " << status;
}
td->stickers_manager_->on_get_installed_sticker_sets_failed(is_masks_, std::move(status)); td->stickers_manager_->on_get_installed_sticker_sets_failed(is_masks_, std::move(status));
} }
}; };
@ -102,7 +104,9 @@ class SearchStickersQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for search stickers: " << status; LOG(ERROR) << "Receive error for search stickers: " << status;
}
td->stickers_manager_->on_find_stickers_fail(emoji_, std::move(status)); td->stickers_manager_->on_find_stickers_fail(emoji_, std::move(status));
} }
}; };
@ -250,7 +254,9 @@ class GetRecentStickersQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for get recent " << (is_attached_ ? "attached " : "") << "stickers: " << status; LOG(ERROR) << "Receive error for get recent " << (is_attached_ ? "attached " : "") << "stickers: " << status;
}
td->stickers_manager_->on_get_recent_stickers_failed(is_repair_, is_attached_, std::move(status)); td->stickers_manager_->on_get_recent_stickers_failed(is_repair_, is_attached_, std::move(status));
} }
}; };
@ -316,7 +322,9 @@ class SaveRecentStickerQuery : public Td::ResultHandler {
return; return;
} }
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for save recent " << (is_attached_ ? "attached " : "") << "sticker: " << status; LOG(ERROR) << "Receive error for save recent " << (is_attached_ ? "attached " : "") << "sticker: " << status;
}
td->stickers_manager_->reload_recent_stickers(is_attached_, true); td->stickers_manager_->reload_recent_stickers(is_attached_, true);
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
@ -358,7 +366,9 @@ class ClearRecentStickersQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for clear recent " << (is_attached_ ? "attached " : "") << "stickers: " << status; LOG(ERROR) << "Receive error for clear recent " << (is_attached_ ? "attached " : "") << "stickers: " << status;
}
td->stickers_manager_->reload_recent_stickers(is_attached_, true); td->stickers_manager_->reload_recent_stickers(is_attached_, true);
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
@ -385,7 +395,9 @@ class GetFavedStickersQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for get favorite stickers: " << status; LOG(ERROR) << "Receive error for get favorite stickers: " << status;
}
td->stickers_manager_->on_get_favorite_stickers_failed(is_repair_, std::move(status)); td->stickers_manager_->on_get_favorite_stickers_failed(is_repair_, std::move(status));
} }
}; };
@ -444,7 +456,9 @@ class FaveStickerQuery : public Td::ResultHandler {
return; return;
} }
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for fave sticker: " << status; LOG(ERROR) << "Receive error for fave sticker: " << status;
}
td->stickers_manager_->reload_favorite_stickers(true); td->stickers_manager_->reload_favorite_stickers(true);
promise_.set_error(std::move(status)); promise_.set_error(std::move(status));
} }
@ -477,7 +491,9 @@ class ReorderStickerSetsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for ReorderStickerSetsQuery: " << status; LOG(ERROR) << "Receive error for ReorderStickerSetsQuery: " << status;
}
td->stickers_manager_->reload_installed_sticker_sets(is_masks_, true); td->stickers_manager_->reload_installed_sticker_sets(is_masks_, true);
} }
}; };
@ -539,7 +555,9 @@ class SearchStickerSetsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for search sticker sets: " << status; LOG(ERROR) << "Receive error for search sticker sets: " << status;
}
td->stickers_manager_->on_find_sticker_sets_fail(query_, std::move(status)); td->stickers_manager_->on_find_sticker_sets_fail(query_, std::move(status));
} }
}; };
@ -632,7 +650,9 @@ class ReadFeaturedStickerSetsQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(ERROR) << "Receive error for ReadFeaturedStickerSetsQuery: " << status; LOG(ERROR) << "Receive error for ReadFeaturedStickerSetsQuery: " << status;
}
td->stickers_manager_->reload_featured_sticker_sets(true); td->stickers_manager_->reload_featured_sticker_sets(true);
} }
}; };

View File

@ -320,7 +320,9 @@ class SetBotUpdatesStatusQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (!G()->close_flag()) {
LOG(WARNING) << "Receive error for SetBotUpdatesStatus: " << status; LOG(WARNING) << "Receive error for SetBotUpdatesStatus: " << status;
}
status.ignore(); status.ignore();
} }
}; };
@ -349,7 +351,7 @@ class UpdateStatusQuery : public Td::ResultHandler {
} }
void on_error(uint64 id, Status status) override { void on_error(uint64 id, Status status) override {
if (status.code() != NetQuery::Cancelled) { if (status.code() != NetQuery::Cancelled && !G()->close_flag()) {
LOG(ERROR) << "Receive error for UpdateStatusQuery: " << status; LOG(ERROR) << "Receive error for UpdateStatusQuery: " << status;
} }
status.ignore(); status.ignore();