Skip to content

Commit

Permalink
fix to only throw in strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Jun 25, 2018
1 parent 7673bbe commit 434511c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/load_map.cpp
Expand Up @@ -545,11 +545,25 @@ void map_parser::parse_style(Map & map, xml_node const& node)

if (!map.insert_style(name, std::move(style)))
{
if (strict_ && map.find_style(name))
boost::optional<const feature_type_style &> dupe = map.find_style(name);
if (strict_)
{
throw config_error("duplicate style name");
if (dupe)
{
throw config_error("duplicate style name");
}
throw config_error("failed to insert style to the map");
}
else
{
std::string s_err("failed to insert style '");
s_err += name + "' to the map";
if (dupe)
{
s_err += " since it was already added";
}
MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err;
}
throw config_error("failed to insert style to the map");
}
}
catch (config_error const& ex)
Expand Down

0 comments on commit 434511c

Please sign in to comment.