diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index be2640849..bf4c0f581 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -76,7 +76,9 @@ bool VectorTileData::reparse(Worker&, std::function callback) { if (result.is()) { state = result.get(); } else { - error = result.get(); + std::stringstream message; + message << "Failed to parse [" << std::string(id) << "]: " << result.get(); + error = message.str(); state = State::obsolete; } diff --git a/src/mbgl/util/worker.cpp b/src/mbgl/util/worker.cpp index 74408a7da..0d83bc49f 100644 --- a/src/mbgl/util/worker.cpp +++ b/src/mbgl/util/worker.cpp @@ -25,8 +25,12 @@ public: } TileParseResult parseVectorTile(TileWorker* worker, std::string data) { - VectorTile vectorTile(pbf(reinterpret_cast(data.data()), data.size())); - return worker->parse(vectorTile); + try { + pbf tilePBF(reinterpret_cast(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) { diff --git a/test/style/resource_loading.cpp b/test/style/resource_loading.cpp index 92d479b51..c37e17d71 100644 --- a/test/style/resource_loading.cpp +++ b/test/style/resource_loading.cpp @@ -159,7 +159,7 @@ TEST_P(ResourceLoading, RequestWithCorruptedData) { message << "Failed to parse "; if (param == "vector.pbf") { - message << "\\[15\\/1638(3|4)\\/1638(3|4)\\]\\: pbf unknown field type exception"; + message << "\\[1(5|6)\\/1638(3|4)\\/1638(3|4)\\]\\: pbf unknown field type exception"; } else { message << "\\[test\\/fixtures\\/resources\\/" << param << "\\]"; }