From 99fa6f63a1944b7a009f3472c4120b96aafe214a Mon Sep 17 00:00:00 2001 From: CoderBear801 Date: Mon, 17 Jun 2019 11:10:22 -0700 Subject: [PATCH] fix: Implement logic for processing professional vender's pbf with OSRM - Put error detail into exceptions instead of using std::cout. --- .../libosmium/include/osmium/io/detail/pbf_decoder.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/third_party/libosmium/include/osmium/io/detail/pbf_decoder.hpp b/third_party/libosmium/include/osmium/io/detail/pbf_decoder.hpp index a29ac1935..5b2e42821 100644 --- a/third_party/libosmium/include/osmium/io/detail/pbf_decoder.hpp +++ b/third_party/libosmium/include/osmium/io/detail/pbf_decoder.hpp @@ -105,9 +105,11 @@ namespace osmium { while (pbf_string_table.next(OSMFormat::StringTable::repeated_bytes_s, protozero::pbf_wire_type::length_delimited)) { const auto str_view = pbf_string_table.get_view(); if (str_view.size() > osmium::max_osm_string_length) { - std::cout<< "### Overlong string error(max-size, overlong-string-size, overlong-string-content)" << str_view.size() << " " - << osmium::max_osm_string_length << " " << str_view.data() << std::endl; - throw osmium::pbf_error{"overlong string in string table"}; + std::string error_detail = "osmium::max_osm_string_length is setting to " + std::to_string(osmium::max_osm_string_length) + + " while this string's length is " + std::to_string(str_view.size()) + + " with content (" + str_view.data() + + ")"; + throw osmium::pbf_error{"overlong string in string table. " + error_detail}; } m_stringtable.emplace_back(str_view.data(), osmium::string_size_type(str_view.size())); }