Skip to content

Commit

Permalink
UI: Handle & log HTTP errors for RemoteTextThread
Browse files Browse the repository at this point in the history
This includes the Patreon fetcher & the log/crash report uploader
  • Loading branch information
WizardCM authored and tommyvct committed Jul 3, 2021
1 parent fb5848c commit debc96f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UI/remote-text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand Down

0 comments on commit debc96f

Please sign in to comment.