UI: Handle & log HTTP errors for RemoteTextThread

This includes the Patreon fetcher & the log/crash report uploader
This commit is contained in:
Matt Gajownik 2021-06-08 19:54:30 +10:00 committed by Jim
parent 85ffdd57f4
commit 1517062251

View File

@ -67,6 +67,7 @@ void RemoteTextThread::run()
curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, "");
curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, header);
curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, error);
curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
string_write);
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str);
@ -88,6 +89,9 @@ void RemoteTextThread::run()
code = curl_easy_perform(curl.get());
if (code != CURLE_OK) {
blog(LOG_WARNING,
"RemoteTextThread: HTTP request failed. %s",
error);
emit Result(QString(), QT_UTF8(error));
} else {
emit Result(QT_UTF8(str.c_str()), QString());