summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-04-28 21:01:57 -0700
committerMerov Linden <merov@lindenlab.com>2014-04-28 21:01:57 -0700
commiteeccd4c381243eb8dbbafdbaf43f30eb74b96048 (patch)
treee18ac591757c4d8613c4ac7a120b9b71fefb0c17 /indra
parentf15442a82a2bfee00694b0097abdf6aeae083e14 (diff)
DD-22 : WIP : Cleaned up error handling in GET merchant
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloatermarketplacelistings.cpp44
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp34
-rwxr-xr-xindra/newview/llmarketplacefunctions.h17
3 files changed, 55 insertions, 40 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index e2bf9f0206..fb6ff211d1 100755
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -234,7 +234,7 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key)
//
// Initialize the Market Place or go update the marketplace listings
//
- if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
+ if (LLMarketplaceData::instance().getSLMStatus() <= MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE)
{
initializeMarketPlace();
}
@@ -350,7 +350,28 @@ void LLFloaterMarketplaceListings::setStatusString(const std::string& statusStri
}
void LLFloaterMarketplaceListings::updateView()
-{
+{
+ U32 mkt_status = LLMarketplaceData::instance().getSLMStatus();
+
+ // Get or create the root folder if we are a merchant and it hasn't been done already
+ if (mRootFolderId.isNull() && (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
+ {
+ setup();
+ }
+
+ // Update the bottom initializing status and progress dial
+ if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING)
+ {
+ setStatusString(getString("MarketplaceListingsInitializing"));
+ mInventoryInitializationInProgress->setVisible(true);
+ }
+ else
+ {
+ setStatusString("");
+ mInventoryInitializationInProgress->setVisible(false);
+ }
+
+ // Update the middle portion : tabs or messages
if (getFolderCount() > 0)
{
mPanelListings->setVisible(TRUE);
@@ -366,26 +387,7 @@ void LLFloaterMarketplaceListings::updateView()
std::string tooltip;
const LLSD& subs = getMarketplaceStringSubstitutions();
- U32 mkt_status = LLMarketplaceData::instance().getSLMStatus();
-
- // Get or create the root folder if we are a merchant and it hasn't been done already
- if (mRootFolderId.isNull() && (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
- {
- setup();
- }
- // Update the bottom initializing status and progress dial
- if (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING)
- {
- setStatusString(getString("MarketplaceListingsInitializing"));
- mInventoryInitializationInProgress->setVisible(true);
- }
- else
- {
- setStatusString("");
- mInventoryInitializationInProgress->setVisible(false);
- }
-
// Update the top message or flip to the tabs and folders view
// *TODO : check those messages and create better appropriate ones in strings.xml
if (mRootFolderId.notNull())
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index b85828ddfd..5804bce819 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -97,6 +97,15 @@ LLSD getMarketplaceStringSubstitutions()
///////////////////////////////////////////////////////////////////////////////
// SLM Responders
+void log_SLM_error(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description)
+{
+ LL_WARNS("SLM") << request << " request failed with a " << status << " " << reason << ". Reason: " << code << " (" << description << ")" << LL_ENDL;
+}
+
+// Merov: This is a temporary hack used by dev while secondlife-staging is down...
+// *TODO : Suppress that before shipping!
+static bool sBypassMerchant = false;
+
class LLSLMMerchantResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLSLMMerchantResponder);
@@ -104,32 +113,23 @@ public:
LLSLMMerchantResponder() {}
- virtual void completed(U32 status, const std::string& reason, const LLSD& content)
- {
- if (isGoodStatus(status))
- {
- llinfos << "Merov : completed successful, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
- LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT);
- }
- else
- {
- llinfos << "Merov : completed with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
- LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
- }
- }
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content) { }
void completedHeader(U32 status, const std::string& reason, const LLSD& content)
{
- if (isGoodStatus(status))
+ if (isGoodStatus(status) || sBypassMerchant)
{
- llinfos << "Merov : completed header successful, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT);
}
- else
+ else if (status == SLMErrorCodes::SLM_NOT_FOUND)
{
- llinfos << "Merov : completed header with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
}
+ else
+ {
+ log_SLM_error("Get merchant", status, reason, content.get("error_code"), content.get("error_description"));
+ LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE);
+ }
}
};
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index d5869d3025..42d76a1ba9 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -115,6 +115,15 @@ private:
// * provide methods to get Marketplace data on any inventory item
// * set Marketplace data
// * signal Marketplace updates to inventory
+namespace SLMErrorCodes
+{
+ enum eCode
+ {
+ SLM_DONE = 200,
+ SLM_NOT_FOUND = 404,
+ };
+}
+
class LLMarketplaceData;
// A Marketplace item is known by its tuple
@@ -145,7 +154,7 @@ class LLMarketplaceData
public:
LLMarketplaceData();
- // SLM
+ // SLM Public
typedef boost::signals2::signal<void ()> status_updated_signal_t;
U32 getSLMStatus() const { return mMarketPlaceStatus; }
void setSLMStatus(U32 status);
@@ -155,7 +164,6 @@ public:
//void postSLMListing();
//void modifySLMListing();
//void associateSLMListing();
- std::string getSLMConnectURL(const std::string& route);
bool isEmpty() { return (mMarketplaceItems.size() == 0); }
@@ -184,9 +192,14 @@ public:
S32 getTestMarketplaceID();
private:
+ // SLM Private
+ std::string getSLMConnectURL(const std::string& route);
+
marketplace_items_list_t mMarketplaceItems;
+
U32 mMarketPlaceStatus;
status_updated_signal_t * mStatusUpdatedSignal;
+
// Merov : This is for test only, waiting for SLM API
S32 mTestCurrentMarketplaceID;
};