From 2bef82cd7a0e8f9eb15e5e3901e7cd13a2a9e731 Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Thu, 13 Oct 2016 01:49:53 +0900
Subject: [PATCH] Warning messages

---
 src/handlers/xdgurl.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp
index b823f01..f8dc2c8 100644
--- a/src/handlers/xdgurl.cpp
+++ b/src/handlers/xdgurl.cpp
@@ -101,6 +101,7 @@ void XdgUrl::_saveDownloadedFile(QNetworkReply *reply)
     QTemporaryFile temporaryFile;
 
     if (!temporaryFile.open() || temporaryFile.write(reply->readAll()) == -1) {
+        qWarning() << temporaryFile.errorString();
         result["error"] = QString("save_error");
         emit finished(Utility::Json::convertObjToStr(result));
         return;
@@ -123,6 +124,7 @@ void XdgUrl::_saveDownloadedFile(QNetworkReply *reply)
     Utility::File::remove(path); // Remove previous downloaded file
 
     if (!temporaryFile.copy(path)) {
+        qWarning() << temporaryFile.errorString();
         result["error"] = QString("save_error");
         emit finished(Utility::Json::convertObjToStr(result));
         return;
@@ -141,6 +143,7 @@ void XdgUrl::_installDownloadedFile(QNetworkReply *reply)
     QTemporaryFile temporaryFile;
 
     if (!temporaryFile.open() || temporaryFile.write(reply->readAll()) == -1) {
+        qWarning() << temporaryFile.errorString();
         result["error"] = QString("save_error");
         emit finished(Utility::Json::convertObjToStr(result));
         return;
@@ -193,6 +196,7 @@ void XdgUrl::_installDownloadedFile(QNetworkReply *reply)
         qInfo() << "Saved the file as" << path;
     }
     else {
+        qWarning() << temporaryFile.errorString();
         result["error"] = QString("install_error");
         emit finished(Utility::Json::convertObjToStr(result));
         return;
@@ -210,9 +214,9 @@ void XdgUrl::_installDownloadedFile(QNetworkReply *reply)
 
 void XdgUrl::_downloaded(QNetworkReply *reply)
 {
-    QJsonObject result;
-
     if (reply->error() != QNetworkReply::NoError) {
+        qWarning() << reply->errorString();
+        QJsonObject result;
         result["error"] = QString("network_error");
         emit finished(Utility::Json::convertObjToStr(result));
         return;
-- 
GitLab