mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
cleanups around exception handling
This commit is contained in:
parent
f9514e5d2c
commit
55ec6a7942
@ -152,7 +152,7 @@ struct value_extractor_visitor : public boost::static_visitor<>
|
||||
{
|
||||
var_ = boost::lexical_cast<T>(val);
|
||||
}
|
||||
catch (boost::bad_lexical_cast & )
|
||||
catch (boost::bad_lexical_cast const& )
|
||||
{
|
||||
std::string err_msg = (boost::format("Failed converting from %s to %s")
|
||||
% typeid(T1).name()
|
||||
|
||||
@ -221,11 +221,11 @@ bool datasource_cache::register_datasource(std::string const& str)
|
||||
<< str << " (dlopen failed - plugin likely has an unsatisfied dependency or incompatible ABI)";
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(datasource_cache)
|
||||
<< "Exception caught while loading plugin library: "
|
||||
<< str;
|
||||
<< str << " (" << ex.what() << ")";
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ void map_parser::parse_map(Map & map, xml_node const& pt, std::string const& bas
|
||||
|
||||
}
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(map_node);
|
||||
throw;
|
||||
@ -382,7 +382,7 @@ void map_parser::parse_map_include(Map & map, xml_node const& include)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const config_error & ex) {
|
||||
} catch (config_error const& ex) {
|
||||
ex.append_context(include);
|
||||
throw;
|
||||
}
|
||||
@ -465,7 +465,7 @@ void map_parser::parse_style(Map & map, xml_node const& sty)
|
||||
}
|
||||
|
||||
map.insert_style(name, style);
|
||||
} catch (const config_error & ex) {
|
||||
} catch (config_error const& ex) {
|
||||
ex.append_context(std::string("in style '") + name + "'", sty);
|
||||
throw;
|
||||
}
|
||||
@ -505,7 +505,7 @@ void map_parser::parse_fontset(Map & map, xml_node const& fset)
|
||||
// when it's parsed
|
||||
fontsets_.insert(std::pair<std::string, font_set>(name, fontset));
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(std::string("in FontSet '") + name + "'", fset);
|
||||
throw;
|
||||
@ -710,7 +710,7 @@ void map_parser::parse_layer(Map & map, xml_node const& node)
|
||||
}
|
||||
map.addLayer(lyr);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
if (!name.empty())
|
||||
{
|
||||
@ -810,7 +810,7 @@ void map_parser::parse_rule(feature_type_style & style, xml_node const& r)
|
||||
style.add_rule(rule);
|
||||
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
if (!name.empty())
|
||||
{
|
||||
@ -933,7 +933,7 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & sym)
|
||||
parse_symbolizer_base(symbol, sym);
|
||||
rule.append(symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1079,7 +1079,7 @@ void map_parser::parse_line_pattern_symbolizer(rule & rule, xml_node const & sym
|
||||
parse_symbolizer_base(symbol, sym);
|
||||
rule.append(symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1132,7 +1132,7 @@ void map_parser::parse_polygon_pattern_symbolizer(rule & rule,
|
||||
parse_symbolizer_base(symbol, sym);
|
||||
rule.append(symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1164,7 +1164,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& sym)
|
||||
|
||||
rule.append(text_symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1265,7 +1265,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym)
|
||||
parse_symbolizer_base(shield_symbol, sym);
|
||||
rule.append(shield_symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1374,7 +1374,7 @@ void map_parser::parse_line_symbolizer(rule & rule, xml_node const & sym)
|
||||
parse_symbolizer_base(symbol, sym);
|
||||
rule.append(symbol);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1403,7 +1403,7 @@ void map_parser::parse_polygon_symbolizer(rule & rule, xml_node const & sym)
|
||||
parse_symbolizer_base(poly_sym, sym);
|
||||
rule.append(poly_sym);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1429,7 +1429,7 @@ void map_parser::parse_building_symbolizer(rule & rule, xml_node const & sym)
|
||||
parse_symbolizer_base(building_sym, sym);
|
||||
rule.append(building_sym);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1521,7 +1521,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym)
|
||||
parse_symbolizer_base(raster_sym, sym);
|
||||
rule.append(raster_sym);
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(sym);
|
||||
throw;
|
||||
@ -1617,7 +1617,7 @@ bool map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc,
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const config_error & ex)
|
||||
catch (config_error const& ex)
|
||||
{
|
||||
ex.append_context(node);
|
||||
throw;
|
||||
|
||||
@ -79,9 +79,11 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (...)
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(mapped_memory_cache) << "Exception caught while loading mapping memory file: " << uri;
|
||||
MAPNIK_LOG_ERROR(mapped_memory_cache)
|
||||
<< "Error loading mapped memory file: '"
|
||||
<< uri << "' (" << ex.what() << ")";
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@ -224,10 +224,6 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
||||
{
|
||||
MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "' (" << ex.what() << ")";
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "'";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ public:
|
||||
populate_tree(child, node);
|
||||
}
|
||||
}
|
||||
catch (rapidxml::parse_error &e)
|
||||
catch (rapidxml::parse_error const& e)
|
||||
{
|
||||
long line = static_cast<long>(
|
||||
std::count(&v.front(), e.where<char>(), '\n') + 1);
|
||||
|
||||
@ -99,7 +99,7 @@ agg::rgba8 parse_color(const char* str)
|
||||
{
|
||||
c = mapnik::parse_color(str);
|
||||
}
|
||||
catch (mapnik::config_error & ex)
|
||||
catch (mapnik::config_error const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(svg_parser) << ex.what();
|
||||
}
|
||||
@ -800,7 +800,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader)
|
||||
{
|
||||
stop_color = mapnik::parse_color(kv.second.c_str());
|
||||
}
|
||||
catch (mapnik::config_error & ex)
|
||||
catch (mapnik::config_error const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(svg_parser) << ex.what();
|
||||
}
|
||||
@ -820,7 +820,7 @@ void parse_gradient_stop(svg_parser & parser, xmlTextReaderPtr reader)
|
||||
{
|
||||
stop_color = mapnik::parse_color((const char *) value);
|
||||
}
|
||||
catch (mapnik::config_error & ex)
|
||||
catch (mapnik::config_error const& ex)
|
||||
{
|
||||
MAPNIK_LOG_ERROR(svg_parser) << ex.what();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user