From 65f9b9c1fdec0bf9f823b56f3361cde50e5c1fa1 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Tue, 29 Sep 2020 19:54:03 +0200 Subject: [PATCH] Improve download error reporting Ref #107 --- downloadthread.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/downloadthread.cpp b/downloadthread.cpp index a503551..aee6a94 100644 --- a/downloadthread.cpp +++ b/downloadthread.cpp @@ -361,10 +361,19 @@ void DownloadThread::run() break; default: deleteDownloadedFile(); + QString errorMsg; + 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 - _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)); } }