Improve download error reporting

Ref #107
This commit is contained in:
Floris Bos 2020-09-29 19:54:03 +02:00
parent c08887f788
commit 65f9b9c1fd

View file

@ -361,10 +361,19 @@ void DownloadThread::run()
break; break;
default: default:
deleteDownloadedFile(); deleteDownloadedFile();
QString errorMsg;
if (!errorBuf[0]) if (!errorBuf[0])
_onDownloadError("Unspecified libcurl error"); /* No detailed error message text provided, use standard text for libcurl result code */
errorMsg += curl_easy_strerror(ret);
else else
_onDownloadError(errorBuf); errorMsg += errorBuf;
char *ipstr;
if (curl_easy_getinfo(_c, CURLINFO_PRIMARY_IP, &ipstr) == CURLE_OK && ipstr && ipstr[0])
errorMsg += QString(" - Server IP: ")+ipstr;
_onDownloadError(tr("Error downloading: %1").arg(errorMsg));
} }
} }