From 85da09d5d51886c898e17372a47ab6fb465d50fe Mon Sep 17 00:00:00 2001
From: James Turner <james@flightgear.org>
Date: Wed, 17 Mar 2021 12:11:30 +0000
Subject: [PATCH] Launcher: improve feedback entering invalid hangar URL.

Catch XML validation/parse errors, and mention the possibility that
the URL is not correct, in the feedback message.
---
 src/GUI/CatalogListModel.cxx    | 4 +++-
 src/GUI/qml/AddCatalogPanel.qml | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/GUI/CatalogListModel.cxx b/src/GUI/CatalogListModel.cxx
index 207433234..1161c13b3 100644
--- a/src/GUI/CatalogListModel.cxx
+++ b/src/GUI/CatalogListModel.cxx
@@ -325,7 +325,9 @@ CatalogListModel::CatalogStatus CatalogListModel::translateStatusForCatalog(Cata
     case Delegate::FAIL_NOT_FOUND:      return NotFoundOnServer;
     case Delegate::FAIL_VERSION:        return IncompatibleVersion;
     case Delegate::FAIL_HTTP_FORBIDDEN: return HTTPForbidden;
-    case Delegate::FAIL_VALIDATION:     return InvalidData;
+    case Delegate::FAIL_VALIDATION:
+    case Delegate::FAIL_EXTRACT:
+        return InvalidData;
     default:
         return UnknownError;
     }
diff --git a/src/GUI/qml/AddCatalogPanel.qml b/src/GUI/qml/AddCatalogPanel.qml
index d2ea0eb05..819c3ffd3 100644
--- a/src/GUI/qml/AddCatalogPanel.qml
+++ b/src/GUI/qml/AddCatalogPanel.qml
@@ -139,8 +139,9 @@ Rectangle {
                        + "(This is version %1)").arg(_launcher.versionString);
 
         case FG.CatalogListModel.InvalidData:
-            return qsTr("The requested hangar seems to be invalid (damaged or incomplete). "
-                        + "Please contact the hangar authors, or try again later");
+            return qsTr("The requested URL doesn't contain valid hangar data. "
+                        + "Check you entered a valid hangar URL. If it's correct, "
+                        + "please contact the hangar authors, or try again later." );
 
         default:
             return qsTr("Unknown error: " + _addOns.catalogs.statusOfAddingCatalog);