Improve network error messages (#4704)

This commit is contained in:
nerix
2023-07-01 14:59:59 +02:00
committed by GitHub
parent d2f1516818
commit 22b290cb2d
15 changed files with 378 additions and 169 deletions
+8 -21
View File
@@ -386,23 +386,17 @@ void SeventvEmotes::loadChannelEmotes(
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
}
}
else if (result.status() == NetworkResult::timedoutStatus)
{
// TODO: Auto retry in case of a timeout, with a delay
qCWarning(chatterinoSeventv)
<< "Fetching 7TV emotes for channel" << channelId
<< "failed due to timeout";
shared->addMessage(makeSystemMessage(
"Failed to fetch 7TV channel emotes. (timed out)"));
}
else
{
// TODO: Auto retry in case of a timeout, with a delay
auto errorString = result.formatError();
qCWarning(chatterinoSeventv)
<< "Error fetching 7TV emotes for channel" << channelId
<< ", error" << result.status();
shared->addMessage(
makeSystemMessage("Failed to fetch 7TV channel "
"emotes. (unknown error)"));
<< ", error" << errorString;
shared->addMessage(makeSystemMessage(
QStringLiteral("Failed to fetch 7TV channel "
"emotes. (Error: %1)")
.arg(errorString)));
}
})
.execute();
@@ -502,14 +496,7 @@ void SeventvEmotes::getEmoteSet(
})
.onError([emoteSetId, callback = std::move(errorCallback)](
const NetworkResult &result) {
if (result.status() == NetworkResult::timedoutStatus)
{
callback("timed out");
}
else
{
callback(QString("status: %1").arg(result.status()));
}
callback(result.formatError());
})
.execute();
}