Catch exceptions when parsing tile PBFs

Also improved the error message and updated the test case.
This commit is contained in:
Thiago Marcos P. Santos
2015-06-10 21:50:35 +03:00
committed by John Firebaugh
parent 3670a78569
commit d30fce5f7d
3 changed files with 10 additions and 4 deletions

View File

@@ -25,8 +25,12 @@ public:
}
TileParseResult parseVectorTile(TileWorker* worker, std::string data) {
VectorTile vectorTile(pbf(reinterpret_cast<const unsigned char *>(data.data()), data.size()));
return worker->parse(vectorTile);
try {
pbf tilePBF(reinterpret_cast<const unsigned char *>(data.data()), data.size());
return worker->parse(VectorTile(tilePBF));
} catch (const std::exception& ex) {
return TileParseResult(ex.what());
}
}
TileParseResult parseLiveTile(TileWorker* worker, const LiveTile* tile) {