forked from organicmaps/organicmaps
[partners_api] taxi::ErrorCode::NoProvider error code is added
This commit is contained in:
parent
168592c349
commit
4f7d03be47
4 changed files with 5 additions and 15 deletions
|
@ -184,7 +184,7 @@ UNIT_TEST(TaxiEngine_ResultMaker)
|
|||
maker.Reset(reqId, 3, successCallback, errorNotPossibleCallback);
|
||||
maker.ProcessProducts(reqId, taxi::Provider::Type::Uber, products1);
|
||||
maker.ProcessProducts(reqId, taxi::Provider::Type::Yandex, products2);
|
||||
maker.DecrementRequestCount(reqId);
|
||||
maker.ProcessError(reqId, taxi::Provider::Type::Uber, taxi::ErrorCode::NoProvider);
|
||||
maker.MakeResult(reqId);
|
||||
|
||||
TEST_EQUAL(providers.size(), 2, ());
|
||||
|
|
|
@ -42,16 +42,6 @@ void ResultMaker::Reset(uint64_t requestId, size_t requestsCount,
|
|||
m_errors.clear();
|
||||
}
|
||||
|
||||
void ResultMaker::DecrementRequestCount(uint64_t requestId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_requestId != requestId)
|
||||
return;
|
||||
|
||||
DecrementRequestCount();
|
||||
}
|
||||
|
||||
void ResultMaker::ProcessProducts(uint64_t requestId, Provider::Type type,
|
||||
std::vector<Product> const & products)
|
||||
{
|
||||
|
@ -136,7 +126,7 @@ uint64_t Engine::GetAvailableProducts(ms::LatLon const & from, ms::LatLon const
|
|||
|
||||
if (!IsAvailableAtPos(type, from))
|
||||
{
|
||||
maker->DecrementRequestCount(reqId);
|
||||
maker->ProcessError(reqId, type, ErrorCode::NoProvider);
|
||||
maker->MakeResult(reqId);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ class ResultMaker
|
|||
public:
|
||||
void Reset(uint64_t requestId, size_t requestsCount, SuccessCallback const & successCallback,
|
||||
ErrorCallback const & errorCallback);
|
||||
/// Reduces number of requests outstanding.
|
||||
void DecrementRequestCount(uint64_t requestId);
|
||||
/// Processes successful callback from taxi api.
|
||||
void ProcessProducts(uint64_t requestId, Provider::Type type,
|
||||
std::vector<Product> const & products);
|
||||
|
|
|
@ -58,7 +58,8 @@ using ProvidersContainer = std::vector<Provider>;
|
|||
enum class ErrorCode
|
||||
{
|
||||
NoProducts,
|
||||
RemoteError
|
||||
RemoteError,
|
||||
NoProvider
|
||||
};
|
||||
|
||||
struct ProviderError
|
||||
|
@ -86,6 +87,7 @@ inline std::string DebugPrint(ErrorCode code)
|
|||
{
|
||||
case ErrorCode::NoProducts: return "NoProducts";
|
||||
case ErrorCode::RemoteError: return "RemoteError";
|
||||
case ErrorCode::NoProvider: return "NoProvider";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue