Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-08-04 09:09:54 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-08-04 09:09:54 +0300
commit021a94715c3e9dd343fef8248b46e7448aa2d7de (patch)
tree5dfe6d455f41fa46445922f334751af446eb4bcc /indexer/altitude_loader.cpp
parentd90fbb6c9fe7a1ea3afcdb976f48d4f4316fcde3 (diff)
Implementing better logging in case of errors.
Diffstat (limited to 'indexer/altitude_loader.cpp')
-rw-r--r--indexer/altitude_loader.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/indexer/altitude_loader.cpp b/indexer/altitude_loader.cpp
index a794c96537..cb05bc4cf6 100644
--- a/indexer/altitude_loader.cpp
+++ b/indexer/altitude_loader.cpp
@@ -31,6 +31,8 @@ namespace feature
{
AltitudeLoader::AltitudeLoader(MwmValue const & mwmValue)
{
+ m_countryFileName = mwmValue.GetCountryFileName();
+
if (mwmValue.GetHeader().GetFormat() < version::Format::v8)
return;
@@ -50,7 +52,7 @@ AltitudeLoader::AltitudeLoader(MwmValue const & mwmValue)
catch (Reader::OpenException const & e)
{
m_header.Reset();
- LOG(LERROR, ("Error while reading", ALTITUDES_FILE_TAG, "section.", e.Msg()));
+ LOG(LERROR, ("File", m_countryFileName, "Error while reading", ALTITUDES_FILE_TAG, "section.", e.Msg()));
}
}
@@ -73,31 +75,34 @@ TAltitudes const & AltitudeLoader::GetAltitudes(uint32_t featureId, size_t point
if (!m_altitudeAvailability[featureId])
{
- LOG(LINFO, ("Feature featureId =", featureId, "does not contain any altitude information."));
+ LOG(LDEBUG, ("Feature Id", featureId, "of", m_countryFileName,
+ "does not contain any altitude information."));
return m_cache.insert(make_pair(featureId, TAltitudes(pointCount, m_header.m_minAltitude))).first->second;
}
uint64_t const r = m_altitudeAvailability.rank(featureId);
- CHECK_LESS(r, m_altitudeAvailability.size(), (featureId));
+ CHECK_LESS(r, m_altitudeAvailability.size(), ("Feature Id", featureId, "of", m_countryFileName));
uint64_t const offset = m_featureTable.select(r);
- CHECK_LESS_OR_EQUAL(offset, m_featureTable.size(), (featureId));
+ CHECK_LESS_OR_EQUAL(offset, m_featureTable.size(), ("Feature Id", featureId, "of", m_countryFileName));
uint64_t const altitudeInfoOffsetInSection = m_header.m_altitudesOffset + offset;
- CHECK_LESS(altitudeInfoOffsetInSection, m_reader->Size(), ());
+ CHECK_LESS(altitudeInfoOffsetInSection, m_reader->Size(), ("Feature Id", featureId, "of", m_countryFileName));
try
{
Altitudes altitudes;
ReaderSource<FilesContainerR::TReader> src(*m_reader);
src.Skip(altitudeInfoOffsetInSection);
- bool const isDeserialized = altitudes.Deserialize(m_header.m_minAltitude, pointCount, src);
+ bool const isDeserialized = altitudes.Deserialize(m_header.m_minAltitude, pointCount,
+ m_countryFileName, featureId, src);
bool const allValid = isDeserialized
&& none_of(altitudes.m_altitudes.begin(), altitudes.m_altitudes.end(),
[](TAltitude a) { return a == kInvalidAltitude; });
if (!allValid)
{
- ASSERT(false, (altitudes.m_altitudes));
+ LOG(LERROR, ("Only a part point of a feature has a valid altitdue. Altitudes: ", altitudes.m_altitudes,
+ ". Feature Id", featureId, "of", m_countryFileName));
return m_cache.insert(make_pair(featureId, TAltitudes(pointCount, m_header.m_minAltitude))).first->second;
}
@@ -105,7 +110,7 @@ TAltitudes const & AltitudeLoader::GetAltitudes(uint32_t featureId, size_t point
}
catch (Reader::OpenException const & e)
{
- LOG(LERROR, ("Error while getting altitude data", e.Msg()));
+ LOG(LERROR, ("Feature Id", featureId, "of", m_countryFileName, ". Error while getting altitude data:", e.Msg()));
return m_cache.insert(make_pair(featureId, TAltitudes(pointCount, m_header.m_minAltitude))).first->second;
}
}