From 03f18a55b7836c22470033267e69f267eb1a8d18 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Wed, 28 Jan 2015 22:16:47 -0800
Subject: [PATCH] DD-320 : Special case HTTP error 422 on the Marketplace and
 give it a nicer error dialog

---
 indra/newview/llmarketplacefunctions.cpp      | 21 ++++++++++++-------
 .../skins/default/xui/en/notifications.xml    | 11 ++++++++++
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index d292dd25e79..ab50506a4f6 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -124,13 +124,20 @@ LLUUID getVersionFolderIfUnique(const LLUUID& folder_id)
 void log_SLM_warning(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description)
 {
     LL_WARNS("SLM") << "SLM API : Responder to " << request << ". status : " << status << ", reason : " << reason << ", code : " << code << ", description : " << description << LL_ENDL;
-    // Prompt the user with the warning (so they know why things are failing)
-    LLSD subs;
-    subs["[ERROR_REASON]"] = reason;
-    // We do show long descriptions in the alert (unlikely to be readable). The description string will be in the log though.
-    subs["[ERROR_DESCRIPTION]"] = (description.length() <= 512 ? description : "");
-    LLNotificationsUtil::add("MerchantTransactionFailed", subs);
-    
+    if (status == 422)
+    {
+        // Unprocessable Entity : Special case that error as it is a frequent answer when trying to list an incomplete listing
+        LLNotificationsUtil::add("MerchantUnprocessableEntity");
+    }
+    else
+    {
+        // Prompt the user with the warning (so they know why things are failing)
+        LLSD subs;
+        subs["[ERROR_REASON]"] = reason;
+        // We do show long descriptions in the alert (unlikely to be readable). The description string will be in the log though.
+        subs["[ERROR_DESCRIPTION]"] = (description.length() <= 512 ? description : "");
+        LLNotificationsUtil::add("MerchantTransactionFailed", subs);
+    }
 }
 void log_SLM_infos(const std::string& request, U32 status, const std::string& body)
 {
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 4c6a61adfd3..570a69256d8 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -343,6 +343,17 @@ Initialization with the Marketplace failed because of a system or network error.
         yestext="OK"/>
     </notification>
     
+    <notification
+        icon="OutboxStatus_Error"
+        name="MerchantUnprocessableEntity"
+        type="outbox">
+        We are unable to list this product. Usually this is caused by missing information in the listing description form. If you continue to see this error, try again later.
+        
+        <usetemplate
+        name="okbutton"
+        yestext="OK"/>
+    </notification>
+
     <notification
         icon="OutboxStatus_Error"
         name="MerchantListingFailed"
-- 
GitLab