DD-22 : WIP : Cleaned up error handling in GET merchant
parent
f15442a82a
commit
eeccd4c381
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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,31 +113,22 @@ 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 if (status == SLMErrorCodes::SLM_NOT_FOUND)
|
||||
{
|
||||
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "Merov : completed header with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
|
||||
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
|
||||
log_SLM_error("Get merchant", status, reason, content.get("error_code"), content.get("error_description"));
|
||||
LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue