Update .clang-format to BraceWrapping: BeforeCatch : true

run `pre-commit`
This commit is contained in:
Artem Pavlenko 2022-11-10 15:57:38 +00:00
parent 1d75721a46
commit a65d65a5ab
84 changed files with 381 additions and 198 deletions

View file

@ -31,7 +31,7 @@ BraceWrapping:
AfterNamespace: false AfterNamespace: false
AfterStruct: true AfterStruct: true
AfterExternBlock: false AfterExternBlock: false
BeforeCatch: false BeforeCatch: true
BeforeElse: true BeforeElse: true
BeforeLambdaBody: false BeforeLambdaBody: false
BeforeWhile: false BeforeWhile: false

View file

@ -132,7 +132,8 @@ inline int handle_args(int argc, char** argv, mapnik::parameters& params)
auto result = run(test_runner, name); \ auto result = run(test_runner, name); \
testing::run_cleanup(); \ testing::run_cleanup(); \
return result; \ return result; \
} catch (std::exception const& ex) \ } \
catch (std::exception const& ex) \
{ \ { \
std::clog << ex.what() << "\n"; \ std::clog << ex.what() << "\n"; \
testing::run_cleanup(); \ testing::run_cleanup(); \
@ -263,7 +264,8 @@ int run(T const& test_runner, std::string const& name)
ips.u); ips.u);
std::clog << msg; std::clog << msg;
return 0; return 0;
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "test runner did not complete: " << ex.what() << "\n"; std::clog << "test runner did not complete: " << ex.what() << "\n";
return 4; return 4;

View file

@ -114,7 +114,8 @@ int main(int argc, char** argv)
test2 test_runner2(params); test2 test_runner2(params);
return_value = return_value | run(test_runner2, "csv_utils::getline_csv"); return_value = return_value | run(test_runner2, "csv_utils::getline_csv");
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
return -1; return -1;

View file

@ -59,10 +59,12 @@ class test_numeric : public benchmark::test_case
try try
{ {
x = boost::numeric_cast<std::uint8_t>(start_ * value_); x = boost::numeric_cast<std::uint8_t>(start_ * value_);
} catch (negative_overflow&) }
catch (negative_overflow&)
{ {
x = std::numeric_limits<std::uint8_t>::min(); x = std::numeric_limits<std::uint8_t>::min();
} catch (positive_overflow&) }
catch (positive_overflow&)
{ {
x = std::numeric_limits<std::uint8_t>::max(); x = std::numeric_limits<std::uint8_t>::max();
} }

View file

@ -112,7 +112,8 @@ int main(int argc, char** argv)
test test_runner(params); test test_runner(params);
return_value = run(test_runner, *name); return_value = run(test_runner, *name);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
return -1; return -1;

View file

@ -167,7 +167,8 @@ int main(int argc, char** argv)
test test_runner(params); test test_runner(params);
return_value = run(test_runner, *name); return_value = run(test_runner, *name);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
return -1; return -1;

View file

@ -370,11 +370,13 @@ int main(int, char**)
#endif #endif
// save map definition (data + style) // save map definition (data + style)
save_map(m, "map.xml"); save_map(m, "map.xml");
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << "### std::exception: " << ex.what() << std::endl; std::cerr << "### std::exception: " << ex.what() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} catch (...) }
catch (...)
{ {
std::cerr << "### Unknown exception." << std::endl; std::cerr << "### Unknown exception." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -85,7 +85,8 @@ int main(int argc, char** argv)
window.set_scaling_factor(scaling_factor); window.set_scaling_factor(scaling_factor);
} }
return app.exec(); return app.exec();
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << "Could not start viewer: '" << ex.what() << "'\n"; std::cerr << "Could not start viewer: '" << ex.what() << "'\n";
return 1; return 1;

View file

@ -189,10 +189,12 @@ void MainWindow::load_map_file(QString const& filename)
{ {
mapnik::auto_cpu_timer t(std::clog, "loading map took: "); mapnik::auto_cpu_timer t(std::clog, "loading map took: ");
mapnik::load_map(*map, filename.toStdString()); mapnik::load_map(*map, filename.toStdString());
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cout << ex.what() << "\n"; std::cout << ex.what() << "\n";
} catch (...) }
catch (...)
{ {
std::cerr << "Exception caught in load_map\n"; std::cerr << "Exception caught in load_map\n";
} }
@ -416,7 +418,8 @@ void MainWindow::set_default_extent(double x0, double y0, double x1, double y1)
mapWidget_->zoomToBox(default_extent_); mapWidget_->zoomToBox(default_extent_);
std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl; std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl;
} }
} catch (...) }
catch (...)
{} {}
} }

View file

@ -513,7 +513,8 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap& pix)
catch (std::exception const& ex) catch (std::exception const& ex)
{ {
std::cerr << "exception: " << ex.what() << std::endl; std::cerr << "exception: " << ex.what() << std::endl;
} catch (...) }
catch (...)
{ {
std::cerr << "Unknown exception caught!\n"; std::cerr << "Unknown exception caught!\n";
} }
@ -602,7 +603,8 @@ void MapWidget::updateMap()
update(); update();
// emit signal to interested widgets // emit signal to interested widgets
emit mapViewChanged(); emit mapViewChanged();
} catch (...) }
catch (...)
{ {
std::cerr << "Unknown exception caught!\n"; std::cerr << "Unknown exception caught!\n";
} }

View file

@ -230,7 +230,8 @@ struct assign_value
try try
{ {
val = parse_color(str); val = parse_color(str);
} catch (...) }
catch (...)
{ {
val = color(0, 0, 0); val = color(0, 0, 0);
} }
@ -266,7 +267,8 @@ std::tuple<T, bool> pre_evaluate_expression(expression_ptr const& expr)
{ {
return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression<T, boost::none_t>(boost::none), *expr), return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression<T, boost::none_t>(boost::none), *expr),
true); true);
} catch (...) }
catch (...)
{ {
return std::make_tuple(T(), false); return std::make_tuple(T(), false);
} }

View file

@ -75,7 +75,8 @@ struct geometry_centroid
{ {
boost::geometry::centroid(geom, pt_); boost::geometry::centroid(geom, pt_);
return true; return true;
} catch (boost::geometry::centroid_exception const& e) }
catch (boost::geometry::centroid_exception const& e)
{ {
return false; return false;
} }

View file

@ -69,7 +69,8 @@ auto push_utf16 = [](auto const& ctx) {
{ {
detail::push_utf8_impl(_val(ctx), *itr); detail::push_utf8_impl(_val(ctx), *itr);
} }
} catch (...) }
catch (...)
{ {
// caught // caught
} }

View file

@ -191,7 +191,8 @@ struct value_extractor_visitor
try try
{ {
var_ = boost::lexical_cast<T>(val); var_ = boost::lexical_cast<T>(val);
} catch (boost::bad_lexical_cast const&) }
catch (boost::bad_lexical_cast const&)
{ {
std::ostringstream s; std::ostringstream s;
s << "Failed converting from " << typeid(T1).name() << " to " << typeid(T).name(); s << "Failed converting from " << typeid(T1).name() << " to " << typeid(T).name();

View file

@ -159,7 +159,8 @@ struct enum_traits<simplify_algorithm_e>
{ \ { \
enum_.from_string(str); \ enum_.from_string(str); \
return result_type(e(enum_)); \ return result_type(e(enum_)); \
} catch (...) \ } \
catch (...) \
{ \ { \
return result_type(); \ return result_type(); \
} \ } \

View file

@ -363,7 +363,8 @@ struct set_symbolizer_property_impl
boost::optional<value_type> val = node.get_opt_attr<value_type>(name); boost::optional<value_type> val = node.get_opt_attr<value_type>(name);
if (val) if (val)
put(sym, key, *val); put(sym, key, *val);
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
// try parsing as an expression // try parsing as an expression
boost::optional<expression_ptr> val = node.get_opt_attr<expression_ptr>(name); boost::optional<expression_ptr> val = node.get_opt_attr<expression_ptr>(name);

View file

@ -63,7 +63,8 @@ struct set_property_from_xml_impl
boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name); boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name);
if (val_) if (val_)
val = *val_; val = *val_;
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name); boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name);
if (val_) if (val_)
@ -88,7 +89,8 @@ struct set_property_from_xml_impl<std::string, false>
boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name); boost::optional<expression_ptr> val_ = node.get_opt_attr<expression_ptr>(name);
if (val_) if (val_)
val = *val_; val = *val_;
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name); boost::optional<target_type> val_ = node.get_opt_attr<target_type>(name);
if (val_) if (val_)
@ -117,7 +119,8 @@ struct set_property_from_xml_impl<T0, true>
e.from_string(*enum_str); e.from_string(*enum_str);
val = enumeration_wrapper(e); val = enumeration_wrapper(e);
} }
} catch (...) }
catch (...)
{ {
boost::optional<expression_ptr> expr = node.get_opt_attr<expression_ptr>(name); boost::optional<expression_ptr> expr = node.get_opt_attr<expression_ptr>(name);
if (expr) if (expr)

View file

@ -135,7 +135,8 @@ class progress_timer : public timer
s << wall_clock_elapsed() << "ms (cpu " << cpu_elapsed() << "ms)"; s << wall_clock_elapsed() << "ms (cpu " << cpu_elapsed() << "ms)";
s << std::setw(30 - (int)s.tellp()) << std::right << "| " << base_message_ << "\n"; s << std::setw(30 - (int)s.tellp()) << std::right << "| " << base_message_ << "\n";
os_ << s.str(); os_ << s.str();
} catch (...) }
catch (...)
{} // eat any exceptions {} // eat any exceptions
} }

View file

@ -174,7 +174,8 @@ struct do_xml_attribute_cast<mapnik::enumeration<T, MAX>>
mapnik::enumeration<T, MAX> e; mapnik::enumeration<T, MAX> e;
e.from_string(source); e.from_string(source);
return result_type(e); return result_type(e);
} catch (illegal_enum_value const& ex) }
catch (illegal_enum_value const& ex)
{ {
MAPNIK_LOG_ERROR(do_xml_attribute_cast) << ex.what(); MAPNIK_LOG_ERROR(do_xml_attribute_cast) << ex.what();
return result_type(); return result_type();

View file

@ -284,7 +284,8 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
} }
multi_type = type; multi_type = type;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
if (strict_) if (strict_)
throw ex; throw ex;
@ -330,7 +331,8 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
} }
multi_type = type; multi_type = type;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
if (strict_) if (strict_)
throw ex; throw ex;

View file

@ -329,7 +329,8 @@ void csv_file_parser::parse_csv_and_boxes(std::istream& csv_file, T& boxes)
++line_number; ++line_number;
break; break;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::string s("CSV Plugin: error parsing headers: "); std::string s("CSV Plugin: error parsing headers: ");
s += ex.what(); s += ex.what();
@ -431,7 +432,8 @@ void csv_file_parser::parse_csv_and_boxes(std::istream& csv_file, T& boxes)
<< values.at(locator_.index) << "'"; << values.at(locator_.index) << "'";
throw mapnik::datasource_exception(s.str()); throw mapnik::datasource_exception(s.str());
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
if (strict_) if (strict_)
throw ex; throw ex;
@ -439,7 +441,8 @@ void csv_file_parser::parse_csv_and_boxes(std::istream& csv_file, T& boxes)
{ {
MAPNIK_LOG_ERROR(csv) << ex.what() << " at line: " << line_number; MAPNIK_LOG_ERROR(csv) << ex.what() << " at line: " << line_number;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::ostringstream s; std::ostringstream s;
s << "CSV Plugin: unexpected error parsing line: " << line_number << " - found " << headers_.size() s << "CSV Plugin: unexpected error parsing line: " << line_number << " - found " << headers_.size()

View file

@ -215,7 +215,8 @@ void geojson_datasource::initialise_disk_index(std::string const& filename)
try try
{ {
mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr); mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
throw std::runtime_error("Failed to parse geojson feature"); throw std::runtime_error("Failed to parse geojson feature");
} }
@ -234,7 +235,8 @@ void parse_geometry_or_feature(Iterator& itr, Iterator const& end, feature_impl&
try try
{ {
parse_feature(start, end, feature, tr); parse_feature(start, end, feature, tr);
} catch (...) }
catch (...)
{ {
start = itr; start = itr;
parse_geometry(start, end, feature); parse_geometry(start, end, feature);
@ -278,14 +280,16 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
try try
{ {
mapnik::json::parse_feature(itr2, end2, *feature, geojson_datasource_static_tr); mapnik::json::parse_feature(itr2, end2, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
throw std::runtime_error("Failed to parse geojson feature"); throw std::runtime_error("Failed to parse geojson feature");
} }
initialise_descriptor(feature); initialise_descriptor(feature);
} }
} }
} catch (...) }
catch (...)
{ {
cache_features_ = true; // force caching single feature cache_features_ = true; // force caching single feature
itr = start; // reset iteraror itr = start; // reset iteraror
@ -294,7 +298,8 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end)
try try
{ {
mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr); mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
if (from_inline_string_) if (from_inline_string_)
throw mapnik::datasource_exception( throw mapnik::datasource_exception(
@ -358,7 +363,8 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
mapnik::json::parse_feature(itr2, end2, *feature, geojson_datasource_static_tr); mapnik::json::parse_feature(itr2, end2, *feature, geojson_datasource_static_tr);
features_.push_back(std::move(feature)); features_.push_back(std::move(feature));
} }
} catch (...) }
catch (...)
{ {
itr = start; itr = start;
// try parsing as single Feature or single Geometry JSON // try parsing as single Feature or single Geometry JSON
@ -366,7 +372,8 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end)
try try
{ {
mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr); mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
if (from_inline_string_) if (from_inline_string_)
throw mapnik::datasource_exception( throw mapnik::datasource_exception(
@ -468,7 +475,8 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
try try
{ {
mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr); mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
throw std::runtime_error("Failed to parse geojson feature"); throw std::runtime_error("Failed to parse geojson feature");
} }
@ -531,7 +539,8 @@ boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_
try try
{ {
mapnik::json::parse_feature(start2, end2, *feature, geojson_datasource_static_tr); mapnik::json::parse_feature(start2, end2, *feature, geojson_datasource_static_tr);
} catch (...) }
catch (...)
{ {
throw std::runtime_error("Failed to parse geojson feature"); throw std::runtime_error("Failed to parse geojson feature");
} }

View file

@ -253,7 +253,8 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
MAPNIK_LOG_DEBUG(pgraster) << "pgraster_datasource: no response from metadata query " << s.str(); MAPNIK_LOG_DEBUG(pgraster) << "pgraster_datasource: no response from metadata query " << s.str();
} }
rs->close(); rs->close();
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
// let this pass on query error and use the fallback below // let this pass on query error and use the fallback below
MAPNIK_LOG_WARN(pgraster) << "pgraster_datasource: metadata query failed: " << ex.what(); MAPNIK_LOG_WARN(pgraster) << "pgraster_datasource: metadata query failed: " << ex.what();
@ -562,7 +563,8 @@ pgraster_datasource::~pgraster_datasource()
{ {
conn->close(); conn->close();
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
// happens when borrowObject tries to // happens when borrowObject tries to
// create a new connection and fails. // create a new connection and fails.

View file

@ -206,7 +206,8 @@ postgis_datasource::postgis_datasource(parameters const& params)
} }
} }
rs->close(); rs->close();
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
// let this pass on query error and use the fallback below // let this pass on query error and use the fallback below
MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what();
@ -470,7 +471,8 @@ postgis_datasource::~postgis_datasource()
{ {
conn->close(); conn->close();
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
// happens when borrowObject tries to // happens when borrowObject tries to
// create a new connection and fails. // create a new connection and fails.
@ -1112,7 +1114,8 @@ boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_
g_type = ""; g_type = "";
} }
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
// let this pass on query error and use the fallback below // let this pass on query error and use the fallback below
MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what();

View file

@ -136,13 +136,16 @@ raster_datasource::raster_datasource(parameters const& params)
width_ = reader->width(); width_ = reader->width();
height_ = reader->height(); height_ = reader->height();
} }
} catch (mapnik::image_reader_exception const& ex) }
catch (mapnik::image_reader_exception const& ex)
{ {
throw datasource_exception("Raster Plugin: image reader exception: " + std::string(ex.what())); throw datasource_exception("Raster Plugin: image reader exception: " + std::string(ex.what()));
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
throw datasource_exception("Raster Plugin: " + std::string(ex.what())); throw datasource_exception("Raster Plugin: " + std::string(ex.what()));
} catch (...) }
catch (...)
{ {
throw datasource_exception("Raster Plugin: image reader unknown exception caught"); throw datasource_exception("Raster Plugin: image reader unknown exception caught");
} }

View file

@ -130,13 +130,16 @@ feature_ptr raster_featureset<LookupPolicy>::next()
feature->set_raster(raster); feature->set_raster(raster);
} }
} }
} catch (mapnik::image_reader_exception const& ex) }
catch (mapnik::image_reader_exception const& ex)
{ {
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: image reader exception caught: " << ex.what(); MAPNIK_LOG_ERROR(raster) << "Raster Plugin: image reader exception caught: " << ex.what();
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: " << ex.what(); MAPNIK_LOG_ERROR(raster) << "Raster Plugin: " << ex.what();
} catch (...) }
catch (...)
{ {
MAPNIK_LOG_ERROR(raster) << "Raster Plugin: exception caught"; MAPNIK_LOG_ERROR(raster) << "Raster Plugin: exception caught";
} }

View file

@ -141,15 +141,18 @@ shape_datasource::shape_datasource(parameters const& params)
break; break;
} }
} }
} catch (datasource_exception const& ex) }
catch (datasource_exception const& ex)
{ {
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what();
throw; throw;
} catch (const std::exception& ex) }
catch (const std::exception& ex)
{ {
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what();
throw; throw;
} catch (...) // exception: pipe_select_interrupter: Too many open files }
catch (...) // exception: pipe_select_interrupter: Too many open files
{ {
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes"; MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes";
throw; throw;

View file

@ -150,7 +150,8 @@ feature_ptr shape_featureset<filterT>::next()
{ {
shape_.dbf().add_attribute(id, *tr_, *feature); // TODO optimize!!! shape_.dbf().add_attribute(id, *tr_, *feature); // TODO optimize!!!
} }
} catch (...) }
catch (...)
{ {
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes";
} }

View file

@ -181,7 +181,8 @@ feature_ptr shape_index_featureset<filterT>::next()
{ {
shape_ptr_->dbf().add_attribute(id, *tr_, *feature); shape_ptr_->dbf().add_attribute(id, *tr_, *feature);
} }
} catch (...) }
catch (...)
{ {
MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes";
} }

View file

@ -53,7 +53,8 @@ shape_io::shape_io(std::string const& shape_name, bool open_index)
try try
{ {
index_ = std::make_unique<shape_file>(shape_name + INDEX); index_ = std::make_unique<shape_file>(shape_name + INDEX);
} catch (...) }
catch (...)
{ {
MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX; MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX;
} }

View file

@ -295,14 +295,16 @@ class sqlite_utils
one_success = true; one_success = true;
} }
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
if (!existed) if (!existed)
{ {
try try
{ {
mapnik::util::remove(index_db); mapnik::util::remove(index_db);
} catch (...) }
catch (...)
{}; {};
} }
throw mapnik::datasource_exception(ex.what()); throw mapnik::datasource_exception(ex.what());
@ -318,7 +320,8 @@ class sqlite_utils
try try
{ {
mapnik::util::remove(index_db); mapnik::util::remove(index_db);
} catch (...) }
catch (...)
{}; {};
} }
return false; return false;
@ -418,14 +421,16 @@ class sqlite_utils
ps.step_next(); ps.step_next();
one_success = true; one_success = true;
} }
} catch (mapnik::datasource_exception const& ex) }
catch (mapnik::datasource_exception const& ex)
{ {
if (!existed) if (!existed)
{ {
try try
{ {
mapnik::util::remove(index_db); mapnik::util::remove(index_db);
} catch (...) }
catch (...)
{}; {};
} }
throw mapnik::datasource_exception(ex.what()); throw mapnik::datasource_exception(ex.what());
@ -441,7 +446,8 @@ class sqlite_utils
try try
{ {
mapnik::util::remove(index_db); mapnik::util::remove(index_db);
} catch (...) }
catch (...)
{}; {};
} }
return false; return false;
@ -517,7 +523,8 @@ class sqlite_utils
{ {
return true; return true;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what(); MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what();
return false; return false;

View file

@ -174,7 +174,8 @@ void topojson_datasource::parse_topojson(T const& buffer)
try try
{ {
boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo_); boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo_);
} catch (boost::spirit::x3::expectation_failure<char const*> const& ex) }
catch (boost::spirit::x3::expectation_failure<char const*> const& ex)
{ {
std::clog << "failed to parse TopoJSON..." << std::endl; std::clog << "failed to parse TopoJSON..." << std::endl;
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;

View file

@ -194,7 +194,8 @@ bool datasource_cache::register_datasources(std::string const& dir, bool recurse
} }
} }
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(datasource_cache) << "register_datasources: " << ex.what(); MAPNIK_LOG_ERROR(datasource_cache) << "register_datasources: " << ex.what();
} }
@ -236,7 +237,8 @@ bool datasource_cache::register_datasource(std::string const& filename)
<< "Problem loading plugin library: " << filename << "Problem loading plugin library: " << filename
<< " (dlopen failed - plugin likely has an unsatisfied dependency or incompatible ABI)"; << " (dlopen failed - plugin likely has an unsatisfied dependency or incompatible ABI)";
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(datasource_cache) MAPNIK_LOG_ERROR(datasource_cache)
<< "Exception caught while loading plugin library: " << filename << " (" << ex.what() << ")"; << "Exception caught while loading plugin library: " << filename << " (" << ex.what() << ")";

View file

@ -46,11 +46,13 @@ expression_ptr parse_expression(std::string const& str)
try try
{ {
r = boost::spirit::x3::phrase_parse(itr, end, parser, space, *node); r = boost::spirit::x3::phrase_parse(itr, end, parser, space, *node);
} catch (boost::spirit::x3::expectation_failure<std::string::const_iterator> const& ex) }
catch (boost::spirit::x3::expectation_failure<std::string::const_iterator> const& ex)
{ {
// no need to show "boost::spirit::x3::expectation_failure" which is a std::runtime_error // no need to show "boost::spirit::x3::expectation_failure" which is a std::runtime_error
throw config_error("Failed to parse expression: \"" + str + "\""); throw config_error("Failed to parse expression: \"" + str + "\"");
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
// show "Could not initialize ICU resources" from boost::regex which is a std::runtime_error // show "Could not initialize ICU resources" from boost::regex which is a std::runtime_error
throw config_error(std::string(ex.what()) + " for expression: \"" + str + "\""); throw config_error(std::string(ex.what()) + " for expression: \"" + str + "\"");

View file

@ -216,7 +216,8 @@ bool freetype_engine::register_fonts_impl(std::string const& dir,
} }
} }
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(font_engine_freetype) << "register_fonts: " << ex.what(); MAPNIK_LOG_ERROR(font_engine_freetype) << "register_fonts: " << ex.what();
} }

View file

@ -75,7 +75,8 @@ image_options_map parse_image_options(std::string const& str)
{ {
throw std::runtime_error("Can't parse image options: " + str); throw std::runtime_error("Can't parse image options: " + str);
} }
} catch (boost::spirit::x3::expectation_failure<std::string> const& ex) }
catch (boost::spirit::x3::expectation_failure<std::string> const& ex)
{ {
throw std::runtime_error("Can't parse image options: " + str + " " + ex.what()); throw std::runtime_error("Can't parse image options: " + str + " " + ex.what());
} }
@ -103,7 +104,8 @@ int parse_png_filters(std::string const& str)
{ {
throw std::runtime_error("Can't parse PNG filters: " + str); throw std::runtime_error("Can't parse PNG filters: " + str);
} }
} catch (boost::spirit::x3::expectation_failure<std::string> const& ex) }
catch (boost::spirit::x3::expectation_failure<std::string> const& ex)
{ {
throw std::runtime_error("Can't parse PNG filters: " + str + " " + ex.what()); throw std::runtime_error("Can't parse PNG filters: " + str + " " + ex.what());
} }

View file

@ -34,7 +34,8 @@ bool from_geojson(std::string const& json, feature_impl& feature)
const char* start = json.c_str(); const char* start = json.c_str();
const char* end = start + json.length(); const char* end = start + json.length();
mapnik::json::parse_feature(start, end, feature); mapnik::json::parse_feature(start, end, feature);
} catch (...) }
catch (...)
{ {
return false; return false;
} }

View file

@ -41,7 +41,8 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry<double>& g
{ {
throw std::runtime_error("Can't parser GeoJSON Geometry"); throw std::runtime_error("Can't parser GeoJSON Geometry");
} }
} catch (...) }
catch (...)
{ {
return false; return false;
} }

View file

@ -306,7 +306,8 @@ void map_parser::parse_map(Map& map, xml_node const& node, std::string const& ba
{ {
// create throwaway projection object here to ensure it is valid // create throwaway projection object here to ensure it is valid
projection proj(srs, true); projection proj(srs, true);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
throw mapnik::config_error(ex.what()); throw mapnik::config_error(ex.what());
} }
@ -387,14 +388,16 @@ void map_parser::parse_map(Map& map, xml_node const& node, std::string const& ba
} }
} }
} }
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(map_node); ex.append_context(map_node);
throw; throw;
} }
parse_map_include(map, map_node); parse_map_include(map, map_node);
} catch (node_not_found const&) }
catch (node_not_found const&)
{ {
throw config_error("Not a map file. Node 'Map' not found."); throw config_error("Not a map file. Node 'Map' not found.");
} }
@ -470,7 +473,8 @@ void map_parser::parse_map_include(Map& map, xml_node const& node)
} }
} }
} }
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -569,7 +573,8 @@ void map_parser::parse_style(Map& map, xml_node const& node)
MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err; MAPNIK_LOG_ERROR(load_map) << "map_parser: " << s_err;
} }
} }
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(std::string("in style '") + name + "'", node); ex.append_context(std::string("in style '") + name + "'", node);
throw; throw;
@ -611,7 +616,8 @@ void map_parser::parse_fontset(Map& map, xml_node const& node)
// when it's parsed // when it's parsed
fontsets_.emplace(name, fontset); fontsets_.emplace(name, fontset);
map.insert_fontset(name, std::move(fontset)); map.insert_fontset(name, std::move(fontset));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(std::string("in FontSet '") + name + "'", node); ex.append_context(std::string("in FontSet '") + name + "'", node);
throw; throw;
@ -676,7 +682,8 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node)
{ {
// create throwaway projection object here to ensure it is valid // create throwaway projection object here to ensure it is valid
projection proj(srs, true); projection proj(srs, true);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
throw mapnik::config_error(ex.what()); throw mapnik::config_error(ex.what());
} }
@ -860,10 +867,12 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node)
{ {
std::shared_ptr<datasource> ds = datasource_cache::instance().create(params); std::shared_ptr<datasource> ds = datasource_cache::instance().create(params);
lyr.set_datasource(ds); lyr.set_datasource(ds);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
throw config_error(ex.what()); throw config_error(ex.what());
} catch (...) }
catch (...)
{ {
throw config_error("Unknown exception occurred attempting to create datasoure for layer '" + throw config_error("Unknown exception occurred attempting to create datasoure for layer '" +
lyr.name() + "'"); lyr.name() + "'");
@ -875,7 +884,8 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node)
} }
} }
parent.add_layer(std::move(lyr)); parent.add_layer(std::move(lyr));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
if (!name.empty()) if (!name.empty())
{ {
@ -923,8 +933,8 @@ void map_parser::parse_rule(feature_type_style& style, xml_node const& node)
parse_symbolizers(rule, node); parse_symbolizers(rule, node);
style.add_rule(std::move(rule)); style.add_rule(std::move(rule));
}
} catch (config_error const& ex) catch (config_error const& ex)
{ {
if (!name.empty()) if (!name.empty())
{ {
@ -1043,7 +1053,8 @@ void map_parser::parse_point_symbolizer(rule& rule, xml_node const& node)
} }
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1061,7 +1072,8 @@ void map_parser::parse_dot_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, double>(sym, keys::height, node); set_symbolizer_property<symbolizer_base, double>(sym, keys::height, node);
set_symbolizer_property<symbolizer_base, composite_mode_e>(sym, keys::comp_op, node); set_symbolizer_property<symbolizer_base, composite_mode_e>(sym, keys::comp_op, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1136,7 +1148,8 @@ void map_parser::parse_markers_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, direction_enum>(sym, keys::direction, node); set_symbolizer_property<symbolizer_base, direction_enum>(sym, keys::direction, node);
parse_stroke(sym, node); parse_stroke(sym, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1180,7 +1193,8 @@ void map_parser::parse_line_pattern_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, line_pattern_enum>(sym, keys::line_pattern, node); set_symbolizer_property<symbolizer_base, line_pattern_enum>(sym, keys::line_pattern, node);
set_symbolizer_property<symbolizer_base, pattern_alignment_enum>(sym, keys::alignment, node); set_symbolizer_property<symbolizer_base, pattern_alignment_enum>(sym, keys::alignment, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1220,7 +1234,8 @@ void map_parser::parse_polygon_pattern_symbolizer(rule& rule, xml_node const& no
set_symbolizer_property<symbolizer_base, pattern_alignment_enum>(sym, keys::alignment, node); set_symbolizer_property<symbolizer_base, pattern_alignment_enum>(sym, keys::alignment, node);
set_symbolizer_property<symbolizer_base, gamma_method_enum>(sym, keys::gamma_method, node); set_symbolizer_property<symbolizer_base, gamma_method_enum>(sym, keys::gamma_method, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1257,7 +1272,8 @@ void map_parser::parse_text_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, value_double>(sym, keys::offset, node); set_symbolizer_property<symbolizer_base, value_double>(sym, keys::offset, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} }
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1332,7 +1348,8 @@ void map_parser::parse_shield_symbolizer(rule& rule, xml_node const& node)
if (halo_rasterizer_) if (halo_rasterizer_)
put(sym, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_)); put(sym, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_));
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1363,7 +1380,8 @@ void map_parser::parse_line_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, double>(sym, keys::offset, node); set_symbolizer_property<symbolizer_base, double>(sym, keys::offset, node);
set_symbolizer_property<symbolizer_base, line_rasterizer_enum>(sym, keys::line_rasterizer, node); set_symbolizer_property<symbolizer_base, line_rasterizer_enum>(sym, keys::line_rasterizer, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1381,7 +1399,8 @@ void map_parser::parse_polygon_symbolizer(rule& rule, xml_node const& node)
set_symbolizer_property<symbolizer_base, double>(sym, keys::gamma, node); set_symbolizer_property<symbolizer_base, double>(sym, keys::gamma, node);
set_symbolizer_property<symbolizer_base, gamma_method_enum>(sym, keys::gamma_method, node); set_symbolizer_property<symbolizer_base, gamma_method_enum>(sym, keys::gamma_method, node);
rule.append(std::move(sym)); rule.append(std::move(sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1401,7 +1420,8 @@ void map_parser::parse_building_symbolizer(rule& rule, xml_node const& node)
if (height) if (height)
put(building_sym, keys::height, *height); put(building_sym, keys::height, *height);
rule.append(std::move(building_sym)); rule.append(std::move(building_sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1492,7 +1512,8 @@ void map_parser::parse_raster_symbolizer(rule& rule, xml_node const& node)
put(raster_sym, keys::colorizer, colorizer); put(raster_sym, keys::colorizer, colorizer);
} }
rule.append(std::move(raster_sym)); rule.append(std::move(raster_sym));
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1540,7 +1561,8 @@ void map_parser::parse_group_symbolizer(rule& rule, xml_node const& node)
} }
put(symbol, keys::group_properties, prop); put(symbol, keys::group_properties, prop);
rule.append(std::move(symbol)); rule.append(std::move(symbol));
} catch (const config_error& ex) }
catch (const config_error& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1635,7 +1657,8 @@ bool map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node
rc->add_stop(stop); rc->add_stop(stop);
} }
} }
} catch (config_error const& ex) }
catch (config_error const& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;
@ -1676,7 +1699,8 @@ void map_parser::parse_group_rule(group_symbolizer_properties& prop, xml_node co
} }
prop.add_rule(std::move(rule)); prop.add_rule(std::move(rule));
} catch (const config_error& ex) }
catch (const config_error& ex)
{ {
ex.append_context(node); ex.append_context(node);
throw; throw;

View file

@ -559,7 +559,8 @@ void Map::zoom_all()
throw std::runtime_error(s.str()); throw std::runtime_error(s.str());
} }
} }
} catch (proj_init_error const& ex) }
catch (proj_init_error const& ex)
{ {
throw mapnik::config_error(std::string("Projection error during map.zoom_all: ") + ex.what()); throw mapnik::config_error(std::string("Projection error during map.zoom_all: ") + ex.what());
} }

View file

@ -91,7 +91,8 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
cache_.emplace(uri, *result); cache_.emplace(uri, *result);
} }
return result; return result;
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(mapped_memory_cache) MAPNIK_LOG_ERROR(mapped_memory_cache)
<< "Error loading mapped memory file: '" << uri << "' (" << ex.what() << ")"; << "Error loading mapped memory file: '" << uri << "' (" << ex.what() << ")";

View file

@ -270,7 +270,8 @@ std::shared_ptr<mapnik::marker const> marker_cache::find(std::string const& uri,
} }
} }
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "' (" << ex.what() << ")"; MAPNIK_LOG_ERROR(marker_cache) << "Exception caught while loading: '" << uri << "' (" << ex.what() << ")";
} }

View file

@ -41,7 +41,8 @@ bool parse_image_filters(std::string const& str, std::vector<filter_type>& image
try try
{ {
r = boost::spirit::x3::phrase_parse(itr, end, grammar, space, image_filters); r = boost::spirit::x3::phrase_parse(itr, end, grammar, space, image_filters);
} catch (...) }
catch (...)
{ {
image_filters.clear(); image_filters.clear();
r = false; r = false;

View file

@ -48,7 +48,8 @@ transform_list_ptr parse_transform(std::string const& str, std::string const& en
try try
{ {
status = boost::spirit::x3::phrase_parse(itr, end, parser, space, *trans_list); status = boost::spirit::x3::phrase_parse(itr, end, parser, space, *trans_list);
} catch (boost::spirit::x3::expectation_failure<std::string::const_iterator> const& ex) }
catch (boost::spirit::x3::expectation_failure<std::string::const_iterator> const& ex)
{ {
throw config_error("Failed to parse transform expression: \"" + str + "\""); throw config_error("Failed to parse transform expression: \"" + str + "\"");
} }

View file

@ -97,7 +97,8 @@ class rapidxml_loader : util::noncopyable
{ {
populate_tree(child, node); populate_tree(child, node);
} }
} catch (rapidxml::parse_error const& e) }
catch (rapidxml::parse_error const& e)
{ {
long line = static_cast<long>(std::count(&array.front(), e.where<char>(), '\n') + 1); long line = static_cast<long>(std::count(&array.front(), e.where<char>(), '\n') + 1);
throw config_error(e.what(), line, filename_); throw config_error(e.what(), line, filename_);

View file

@ -212,7 +212,8 @@ mapnik::color parse_color(T& err_handler, const char* str)
try try
{ {
c = mapnik::parse_color(str); c = mapnik::parse_color(str);
} catch (mapnik::config_error const& ex) }
catch (mapnik::config_error const& ex)
{ {
err_handler.on_error("SVG parse error: failed to parse <color> with value \"" + std::string(str) + "\""); err_handler.on_error("SVG parse error: failed to parse <color> with value \"" + std::string(str) + "\"");
} }
@ -383,7 +384,8 @@ std::pair<unsigned, bool> parse_preserve_aspect_ratio(T& err_handler, char const
-x3::lit("defer") // only applicable to <image> which we don't support currently -x3::lit("defer") // only applicable to <image> which we don't support currently
> align[apply_align] > -(x3::lit("meet") | x3::lit("slice")[apply_slice]), > align[apply_align] > -(x3::lit("meet") | x3::lit("slice")[apply_slice]),
x3::space); x3::space);
} catch (x3::expectation_failure<char const*> const& ex) }
catch (x3::expectation_failure<char const*> const& ex)
{ {
err_handler.on_error("SVG parse error: failed to parse <preserveAspectRatio> with value \"" + std::string(str) + err_handler.on_error("SVG parse error: failed to parse <preserveAspectRatio> with value \"" + std::string(str) +
"\""); "\"");
@ -1671,7 +1673,8 @@ void svg_parser::parse(std::string const& filename)
try try
{ {
doc.parse<flags>(buffer.data()); doc.parse<flags>(buffer.data());
} catch (rapidxml::parse_error const& ex) }
catch (rapidxml::parse_error const& ex)
{ {
std::stringstream ss; std::stringstream ss;
ss << "SVG error: unable to parse \"" << filename << "\""; ss << "SVG error: unable to parse \"" << filename << "\"";
@ -1693,7 +1696,8 @@ void svg_parser::parse_from_string(std::string const& svg)
try try
{ {
doc.parse<flags>(buffer.data()); doc.parse<flags>(buffer.data());
} catch (rapidxml::parse_error const& ex) }
catch (rapidxml::parse_error const& ex)
{ {
std::stringstream ss; std::stringstream ss;
std::string str = (svg.length() > 1024) ? svg.substr(0, 1024) + "..." : svg; std::string str = (svg.length() > 1024) ? svg.substr(0, 1024) + "..." : svg;

View file

@ -53,7 +53,8 @@ bool parse_path(const char* wkt, PathType& p)
{ {
throw std::runtime_error("Failed to parse svg-path"); throw std::runtime_error("Failed to parse svg-path");
} }
} catch (...) }
catch (...)
{ {
return false; return false;
} }

View file

@ -53,7 +53,8 @@ bool parse_points(const char* wkt, PathType& p)
{ {
throw std::runtime_error("Failed to parse svg-path"); throw std::runtime_error("Failed to parse svg-path");
} }
} catch (...) }
catch (...)
{ {
return false; return false;
} }

View file

@ -53,7 +53,8 @@ bool parse_svg_transform(const char* wkt, Transform& tr)
{ {
throw std::runtime_error("Failed to parse svg-transform"); throw std::runtime_error("Failed to parse svg-transform");
} }
} catch (...) }
catch (...)
{ {
return false; return false;
} }

View file

@ -210,7 +210,8 @@ text_placements_ptr text_placements_simple::from_xml(xml_node const& xml, fontse
ptr->defaults.from_xml(xml, fontsets, is_shield); ptr->defaults.from_xml(xml, fontsets, is_shield);
return ptr; return ptr;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
// otherwise ensure it is valid // otherwise ensure it is valid
std::vector<directions_e> direction; std::vector<directions_e> direction;

View file

@ -36,7 +36,8 @@ bool from_wkt(std::string const& wkt, mapnik::geometry::geometry<double>& geom)
try try
{ {
result = x3::phrase_parse(itr, end, grammar::wkt, space, geom); result = x3::phrase_parse(itr, end, grammar::wkt, space, geom);
} catch (x3::expectation_failure<std::string::const_iterator> const& ex) }
catch (x3::expectation_failure<std::string::const_iterator> const& ex)
{ {
return false; return false;
} }

View file

@ -3503,7 +3503,8 @@ class Capturer
{ \ { \
static_cast<void>(__VA_ARGS__); \ static_cast<void>(__VA_ARGS__); \
catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
} catch (...) \ } \
catch (...) \
{ \ { \
catchAssertionHandler.handleUnexpectedInflightException(); \ catchAssertionHandler.handleUnexpectedInflightException(); \
} \ } \
@ -3523,7 +3524,8 @@ class Capturer
{ \ { \
static_cast<void>(__VA_ARGS__); \ static_cast<void>(__VA_ARGS__); \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} catch (...) \ } \
catch (...) \
{ \ { \
catchAssertionHandler.handleExceptionThrownAsExpected(); \ catchAssertionHandler.handleExceptionThrownAsExpected(); \
} \ } \
@ -3546,10 +3548,12 @@ class Capturer
{ \ { \
static_cast<void>(expr); \ static_cast<void>(expr); \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} catch (exceptionType const&) \ } \
catch (exceptionType const&) \
{ \ { \
catchAssertionHandler.handleExceptionThrownAsExpected(); \ catchAssertionHandler.handleExceptionThrownAsExpected(); \
} catch (...) \ } \
catch (...) \
{ \ { \
catchAssertionHandler.handleUnexpectedInflightException(); \ catchAssertionHandler.handleUnexpectedInflightException(); \
} \ } \
@ -3602,7 +3606,8 @@ class Capturer
{ \ { \
static_cast<void>(__VA_ARGS__); \ static_cast<void>(__VA_ARGS__); \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} catch (...) \ } \
catch (...) \
{ \ { \
Catch::handleExceptionMatchExpr(catchAssertionHandler, matcher, #matcher##_catch_sr); \ Catch::handleExceptionMatchExpr(catchAssertionHandler, matcher, #matcher##_catch_sr); \
} \ } \
@ -3849,7 +3854,8 @@ class ExceptionTranslatorRegistrar
std::rethrow_exception(std::current_exception()); std::rethrow_exception(std::current_exception());
else else
return (*it)->translate(it + 1, itEnd); return (*it)->translate(it + 1, itEnd);
} catch (T& ex) }
catch (T& ex)
{ {
return m_translateFunction(ex); return m_translateFunction(ex);
} }
@ -4727,10 +4733,12 @@ auto makeMatchExpr(ArgT const& arg, MatcherT const& matcher, StringRef const& ma
{ \ { \
static_cast<void>(__VA_ARGS__); \ static_cast<void>(__VA_ARGS__); \
catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
} catch (exceptionType const& ex) \ } \
catch (exceptionType const& ex) \
{ \ { \
catchAssertionHandler.handleExpr(Catch::makeMatchExpr(ex, matcher, #matcher##_catch_sr)); \ catchAssertionHandler.handleExpr(Catch::makeMatchExpr(ex, matcher, #matcher##_catch_sr)); \
} catch (...) \ } \
catch (...) \
{ \ { \
catchAssertionHandler.handleUnexpectedInflightException(); \ catchAssertionHandler.handleUnexpectedInflightException(); \
} \ } \
@ -12197,7 +12205,8 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const
@try @try
{ {
return tryTranslators(); return tryTranslators();
} @catch (NSException* exception) }
@catch (NSException* exception)
{ {
return Catch::Detail::stringify([exception description]); return Catch::Detail::stringify([exception description]);
} }
@ -12216,19 +12225,24 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const
} }
return tryTranslators(); return tryTranslators();
#endif #endif
} catch (TestFailureException&) }
catch (TestFailureException&)
{ {
std::rethrow_exception(std::current_exception()); std::rethrow_exception(std::current_exception());
} catch (std::exception& ex) }
catch (std::exception& ex)
{ {
return ex.what(); return ex.what();
} catch (std::string& msg) }
catch (std::string& msg)
{ {
return msg; return msg;
} catch (const char* msg) }
catch (const char* msg)
{ {
return msg; return msg;
} catch (...) }
catch (...)
{ {
return "Unknown exception"; return "Unknown exception";
} }
@ -15201,7 +15215,8 @@ Session::Session()
try try
{ {
std::rethrow_exception(ex_ptr); std::rethrow_exception(ex_ptr);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
Catch::cerr() << Column(ex.what()).indent(2) << '\n'; Catch::cerr() << Column(ex.what()).indent(2) << '\n';
} }

View file

@ -7,7 +7,8 @@
try \ try \
{ \ { \
CHECK(expr); \ CHECK(expr); \
} catch (Catch::TestFailureException&) \ } \
catch (Catch::TestFailureException&) \
{ \ { \
/* thrown by CHECK after it catches and reports */ \ /* thrown by CHECK after it catches and reports */ \
/* an exception from expr => swallow this */ \ /* an exception from expr => swallow this */ \
@ -17,7 +18,8 @@
try \ try \
{ \ { \
CHECK_FALSE(expr); \ CHECK_FALSE(expr); \
} catch (Catch::TestFailureException&) \ } \
catch (Catch::TestFailureException&) \
{} {}
#endif // TEST_CATCH_EXT_HPP #endif // TEST_CATCH_EXT_HPP

View file

@ -42,7 +42,8 @@ TEST_CASE("datasource_cache")
success = cache.register_datasources("plugins/input", true); success = cache.register_datasources("plugins/input", true);
CHECK(success == false); CHECK(success == false);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -165,7 +165,8 @@ TEST_CASE("font")
mapnik::freetype_engine::register_fonts("C:\\Windows\\Fonts", true); mapnik::freetype_engine::register_fonts("C:\\Windows\\Fonts", true);
face_names = mapnik::freetype_engine::face_names(); face_names = mapnik::freetype_engine::face_names();
REQUIRE(face_names.size() > 22); REQUIRE(face_names.size() > 22);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -54,13 +54,13 @@ class tmp_dir
break; break;
} }
} }
}
} catch (const std::exception& e) catch (const std::exception& e)
{ {
std::cerr << "Exception caught while trying to remove " std::cerr << "Exception caught while trying to remove "
<< "temporary directory " << m_path << ": " << e.what() << "\n"; << "temporary directory " << m_path << ": " << e.what() << "\n";
}
} catch (...) catch (...)
{ {
std::cerr << "Unknown exception caught while trying to " std::cerr << "Unknown exception caught while trying to "
<< "remove temporary directory " << m_path << "\n"; << "remove temporary directory " << m_path << "\n";
@ -121,7 +121,8 @@ void load_map(mapnik::Map& m, bfs::path const& path)
try try
{ {
mapnik::load_map(m, path.generic_string()); mapnik::load_map(m, path.generic_string());
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
// errors which come from the datasource not being loaded or // errors which come from the datasource not being loaded or
// database not being set up aren't really useful - they're // database not being set up aren't really useful - they're

View file

@ -300,8 +300,8 @@ TEST_CASE("conversions")
mapnik::value streamable(ustr); mapnik::value streamable(ustr);
s << streamable; s << streamable;
CHECK(s.str() == std::string("hello world!")); CHECK(s.str() == std::string("hello world!"));
}
} catch (std::exception const& ex) catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -68,7 +68,8 @@ TEST_CASE("copy")
REQUIRE((m0 == m2)); REQUIRE((m0 == m2));
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -30,7 +30,8 @@ TEST_CASE("exceptions")
// to avoid unused variable warning // to avoid unused variable warning
srs.params(); srs.params();
REQUIRE(false); REQUIRE(false);
} catch (...) }
catch (...)
{ {
REQUIRE(true); REQUIRE(true);
} }
@ -44,7 +45,8 @@ TEST_CASE("exceptions")
srs.init_proj(); srs.init_proj();
// oddly init_proj does not throw with old proj/ubuntu precise // oddly init_proj does not throw with old proj/ubuntu precise
// REQUIRE(false); // REQUIRE(false);
} catch (...) }
catch (...)
{ {
REQUIRE(true); REQUIRE(true);
} }
@ -53,7 +55,8 @@ TEST_CASE("exceptions")
{ {
mapnik::transcoder tr("bogus encoding"); mapnik::transcoder tr("bogus encoding");
REQUIRE(false); REQUIRE(false);
} catch (...) }
catch (...)
{ {
REQUIRE(true); REQUIRE(true);
} }
@ -88,7 +91,8 @@ TEST_CASE("exceptions")
// should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y." // should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y."
ren.apply(); ren.apply();
REQUIRE(false); REQUIRE(false);
} catch (...) }
catch (...)
{ {
REQUIRE(true); REQUIRE(true);
} }
@ -104,7 +108,8 @@ TEST_CASE("exceptions")
p2["file"] = "foo"; p2["file"] = "foo";
mapnik::datasource_cache::instance().create(p2); mapnik::datasource_cache::instance().create(p2);
REQUIRE(false); REQUIRE(false);
} catch (...) }
catch (...)
{ {
REQUIRE(true); REQUIRE(true);
} }

View file

@ -103,7 +103,8 @@ TEST_CASE("parameters")
params["member"] = holder_member; params["member"] = holder_member;
REQUIRE((params.get<std::string>("member") == std::string("member"))); REQUIRE((params.get<std::string>("member") == std::string("member")));
REQUIRE((holder_member == std::string("member"))); REQUIRE((holder_member == std::string("member")));
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -60,7 +60,8 @@ bool parse_topology_string(std::string const& buffer, mapnik::topojson::topology
try try
{ {
boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo); boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo);
} catch (boost::spirit::x3::expectation_failure<char const*> const& ex) }
catch (boost::spirit::x3::expectation_failure<char const*> const& ex)
{ {
std::cerr << "failed to parse TopoJSON..." << std::endl; std::cerr << "failed to parse TopoJSON..." << std::endl;
std::cerr << ex.what() << std::endl; std::cerr << ex.what() << std::endl;

View file

@ -64,7 +64,8 @@ TEST_CASE("fontset")
mapnik::image_rgba8 buf(m.width(), m.height()); mapnik::image_rgba8 buf(m.width(), m.height());
mapnik::agg_renderer<mapnik::image_rgba8> ren(m, buf); mapnik::agg_renderer<mapnik::image_rgba8> ren(m, buf);
ren.apply(); ren.apply();
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(std::string(ex.what()) == REQUIRE(std::string(ex.what()) ==
std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'")); std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'"));

View file

@ -80,7 +80,8 @@ TEST_CASE("image io")
{ {
std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw, *type)); std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw, *type));
REQUIRE(false); REQUIRE(false);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE( REQUIRE(
std::string(ex.what()) == std::string(ex.what()) ==
@ -132,7 +133,8 @@ TEST_CASE("image io")
REQUIRE(type); REQUIRE(type);
REQUIRE_THROWS(mapnik::get_image_reader(should_throw, *type)); REQUIRE_THROWS(mapnik::get_image_reader(should_throw, *type));
#endif #endif
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -62,7 +62,8 @@ TEST_CASE("image")
REQUIRE(image.painted() == true); REQUIRE(image.painted() == true);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;
REQUIRE(false); REQUIRE(false);

View file

@ -187,7 +187,8 @@ TEST_CASE("blending")
REQUIRE( to_string(blend<source_over_old_agg>(source,dest,cover)) == expected_str ); REQUIRE( to_string(blend<source_over_old_agg>(source,dest,cover)) == expected_str );
} }
*/ */
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << "\n"; std::clog << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -104,7 +104,6 @@ TEST_CASE("geometry formats")
sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]), sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]),
mapnik::wkbGeneric); mapnik::wkbGeneric);
REQUIRE(geom.is<mapnik::geometry::geometry_empty>()); // returns geometry_empty REQUIRE(geom.is<mapnik::geometry::geometry_empty>()); // returns geometry_empty
} }
catch (std::exception const& ex) catch (std::exception const& ex)
{ {

View file

@ -16,7 +16,6 @@
#include <vector> #include <vector>
#include <fstream> #include <fstream>
namespace { namespace {
struct spatially_equal_visitor struct spatially_equal_visitor
@ -98,7 +97,6 @@ bool spatially_equal(mapnik::geometry::geometry<T> const& g0, mapnik::geometry::
} // namespace } // namespace
TEST_CASE("Well-known-geometries") TEST_CASE("Well-known-geometries")
{ {
SECTION("wkb+wkt") SECTION("wkb+wkt")

View file

@ -89,7 +89,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse(svg_name); p->parse(svg_name);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == join(expected_errors)); REQUIRE(ex.what() == join(expected_errors));
} }
@ -109,7 +110,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse_from_string(svg_str); p->parse_from_string(svg_str);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == join(expected_errors)); REQUIRE(ex.what() == join(expected_errors));
} }
@ -124,7 +126,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse(svg_name); p->parse(svg_name);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == join(expected_errors)); REQUIRE(ex.what() == join(expected_errors));
} }
@ -151,7 +154,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse_from_string(svg_str); p->parse_from_string(svg_str);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == std::string(expected_errors[0])); REQUIRE(ex.what() == std::string(expected_errors[0]));
} }
@ -192,7 +196,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse_from_string(svg_str); p->parse_from_string(svg_str);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == std::string(expected_errors[0])); REQUIRE(ex.what() == std::string(expected_errors[0]));
} }
@ -217,7 +222,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse_from_string(svg_str); p->parse_from_string(svg_str);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == std::string(expected_errors[0])); REQUIRE(ex.what() == std::string(expected_errors[0]));
} }
@ -601,7 +607,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse(svg_name); p->parse(svg_name);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == std::string(expected_errors[0])); REQUIRE(ex.what() == std::string(expected_errors[0]));
} }
@ -627,7 +634,8 @@ TEST_CASE("SVG parser")
try try
{ {
p->parse_from_string(svg_str); p->parse_from_string(svg_str);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
REQUIRE(ex.what() == std::string(expected_errors[0])); REQUIRE(ex.what() == std::string(expected_errors[0]));
} }

View file

@ -19,7 +19,8 @@ TEST_CASE("symbolizer")
REQUIRE(sym.properties.count(keys::markers_multipolicy) == static_cast<unsigned long>(1)); REQUIRE(sym.properties.count(keys::markers_multipolicy) == static_cast<unsigned long>(1));
marker_multi_policy_enum policy_out = get<mapnik::marker_multi_policy_enum>(sym, keys::markers_multipolicy); marker_multi_policy_enum policy_out = get<mapnik::marker_multi_policy_enum>(sym, keys::markers_multipolicy);
REQUIRE(policy_out == MARKER_WHOLE_MULTI); REQUIRE(policy_out == MARKER_WHOLE_MULTI);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;
REQUIRE(false); REQUIRE(false);

View file

@ -109,7 +109,8 @@ TEST_CASE("clipping")
REQUIRE(clip_line(bbox, path) == mapnik::util::trim_copy(parts[2])); REQUIRE(clip_line(bbox, path) == mapnik::util::trim_copy(parts[2]));
} }
stream.close(); stream.close();
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
} }

View file

@ -19,7 +19,8 @@ TEST_CASE("extend converter")
mapnik::extend_converter<fake_path> c(path, 1000); mapnik::extend_converter<fake_path> c(path, 1000);
double x, y; double x, y;
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -38,7 +39,8 @@ TEST_CASE("extend converter")
REQUIRE(y == 0); REQUIRE(y == 0);
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -59,7 +61,8 @@ TEST_CASE("extend converter")
REQUIRE(x == 1001); REQUIRE(x == 1001);
REQUIRE(y == 0); REQUIRE(y == 0);
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -83,7 +86,8 @@ TEST_CASE("extend converter")
REQUIRE(x == 1002); REQUIRE(x == 1002);
REQUIRE(y == 0); REQUIRE(y == 0);
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -116,7 +120,8 @@ TEST_CASE("extend converter")
REQUIRE(x == 1005); REQUIRE(x == 1005);
REQUIRE(y == 0); REQUIRE(y == 0);
REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -161,7 +161,8 @@ TEST_CASE("offsets")
// curve. // curve.
test_s_shaped_curve(offset); test_s_shaped_curve(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -265,7 +265,8 @@ TEST_CASE("offset converter")
// find the correspondance here. // find the correspondance here.
offset_test::test_null_segment(offset); offset_test::test_null_segment(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -283,7 +284,8 @@ TEST_CASE("offset converter")
// find the correspondance here. // find the correspondance here.
offset_test::test_invalid_segment(offset); offset_test::test_invalid_segment(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -301,7 +303,8 @@ TEST_CASE("offset converter")
// find the correspondance here. // find the correspondance here.
offset_test::test_simple_segment(offset); offset_test::test_simple_segment(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -318,7 +321,8 @@ TEST_CASE("offset converter")
// test straight line consisting of more than one segment. // test straight line consisting of more than one segment.
offset_test::test_straight_line(offset); offset_test::test_straight_line(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -334,7 +338,8 @@ TEST_CASE("offset converter")
{ {
offset_test::test_offset_curve(offset); offset_test::test_offset_curve(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);
@ -350,7 +355,8 @@ TEST_CASE("offset converter")
{ {
offset_test::test_s_shaped_curve(offset); offset_test::test_s_shaped_curve(offset);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
REQUIRE(false); REQUIRE(false);

View file

@ -214,7 +214,8 @@ int main(int argc, char** argv)
{ {
results = run.test_all(report); results = run.test_all(report);
} }
} catch (std::exception& e) }
catch (std::exception& e)
{ {
std::cerr << "Error running tests: " << e.what() << std::endl; std::cerr << "Error running tests: " << e.what() << std::endl;
return 1; return 1;

View file

@ -234,7 +234,8 @@ result_list runner::test_range(files_iterator begin,
{ {
result_list r = test_one(file, report, fail_count.get()); result_list r = test_one(file, report, fail_count.get());
std::move(r.begin(), r.end(), std::back_inserter(results)); std::move(r.begin(), r.end(), std::back_inserter(results));
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
result r; result r;
r.state = STATE_ERROR; r.state = STATE_ERROR;
@ -303,7 +304,8 @@ result_list
try try
{ {
mapnik::load_map(map, style_path.string(), true); mapnik::load_map(map, style_path.string(), true);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::string what = ex.what(); std::string what = ex.what();
if (what.find("Could not create datasource") != std::string::npos || if (what.find("Could not create datasource") != std::string::npos ||

View file

@ -54,7 +54,8 @@ int main(int argc, char** argv)
try try
{ {
ds = mapnik::datasource_cache::instance().create(p); ds = mapnik::datasource_cache::instance().create(p);
} catch (...) }
catch (...)
{ {
std::cerr << "Can't create datasource!\n"; std::cerr << "Can't create datasource!\n";
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -147,7 +147,8 @@ int main(int argc, char** argv)
{ {
use_bbox = true; use_bbox = true;
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "Error: " << ex.what() << std::endl; std::clog << "Error: " << ex.what() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -54,7 +54,8 @@ std::pair<bool, typename T::value_type::first_type>
{ {
p.parse_csv_and_boxes(csv_file.file(), boxes); p.parse_csv_and_boxes(csv_file.file(), boxes);
return std::make_pair(true, box_type(p.extent_)); return std::make_pair(true, box_type(p.extent_));
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;
return std::make_pair(false, box_type(p.extent_)); return std::make_pair(false, box_type(p.extent_));

View file

@ -280,13 +280,15 @@ std::pair<bool, typename T::value_type::first_type>
try try
{ {
mapnik::json::extract_bounding_boxes(itr, end, boxes); mapnik::json::extract_bounding_boxes(itr, end, boxes);
} catch (boost::spirit::x3::expectation_failure<base_iterator_type> const& ex) }
catch (boost::spirit::x3::expectation_failure<base_iterator_type> const& ex)
{ {
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;
std::clog << "Expected: " << ex.which(); std::clog << "Expected: " << ex.which();
std::clog << " Got: \"" << std::string(ex.where(), ex.where() + 200) << '"' << std::endl; std::clog << " Got: \"" << std::string(ex.where(), ex.where() + 200) << '"' << std::endl;
return std::make_pair(false, extent); return std::make_pair(false, extent);
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "mapnik-index (GeoJSON) : could not extract bounding boxes from : '" << filename << "'" std::clog << "mapnik-index (GeoJSON) : could not extract bounding boxes from : '" << filename << "'"
<< std::endl; << std::endl;
@ -324,12 +326,14 @@ std::pair<bool, typename T::value_type::first_type>
<< " size=" << item.second.second << std::endl; << " size=" << item.second.second << std::endl;
return std::make_pair(false, extent); return std::make_pair(false, extent);
} }
} catch (x3::expectation_failure<std::string::const_iterator> const& ex) }
catch (x3::expectation_failure<std::string::const_iterator> const& ex)
{ {
if (verbose) if (verbose)
std::clog << ex.what() << std::endl; std::clog << ex.what() << std::endl;
return std::make_pair(false, extent); return std::make_pair(false, extent);
} catch (...) }
catch (...)
{ {
if (verbose) if (verbose)
std::clog << "Failed to parse: offset=" << item.second.first << " size=" << item.second.second std::clog << "Failed to parse: offset=" << item.second.first << " size=" << item.second.second

View file

@ -173,7 +173,8 @@ int main(int argc, char** argv)
{ {
std::clog << "rendered to: " << img_file << "\n"; std::clog << "rendered to: " << img_file << "\n";
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "Error " << ex.what() << std::endl; std::clog << "Error " << ex.what() << std::endl;
return -1; return -1;

View file

@ -101,7 +101,8 @@ int main(int argc, char** argv)
{ {
ogr_files = vm["ogr_files"].as<vector<string>>(); ogr_files = vm["ogr_files"].as<vector<string>>();
} }
} catch (...) }
catch (...)
{ {
std::clog << "Exception of unknown type!" << std::endl; std::clog << "Exception of unknown type!" << std::endl;
return -1; return -1;

View file

@ -105,12 +105,14 @@ int main(int argc, char** argv)
std::cout << "output_table : " << output_table_name << "\n"; std::cout << "output_table : " << output_table_name << "\n";
mapnik::pgsql2sqlite(conn, query, output_table_name, output_file); mapnik::pgsql2sqlite(conn, query, output_table_name, output_file);
} catch (mapnik::datasource_exception& ex) }
catch (mapnik::datasource_exception& ex)
{ {
std::cerr << ex.what() << "\n"; std::cerr << ex.what() << "\n";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} catch (std::exception& e) }
catch (std::exception& e)
{ {
std::cerr << desc << "\n"; std::cerr << desc << "\n";
std::cout << usage << "\n"; std::cout << usage << "\n";

View file

@ -118,7 +118,8 @@ int main(int argc, char** argv)
{ {
shape_files = vm["shape_files"].as<std::vector<std::string>>(); shape_files = vm["shape_files"].as<std::vector<std::string>>();
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "Error: " << ex.what() << std::endl; std::clog << "Error: " << ex.what() << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -242,11 +242,13 @@ int main(int argc, char** argv)
main_marker_visitor visitor(svg_name, scale_factor, verbose, auto_open); main_marker_visitor visitor(svg_name, scale_factor, verbose, auto_open);
status = mapnik::util::apply_visitor(visitor, *marker); status = mapnik::util::apply_visitor(visitor, *marker);
} }
} catch (std::exception const& ex) }
catch (std::exception const& ex)
{ {
std::clog << "Exception caught:" << ex.what() << std::endl; std::clog << "Exception caught:" << ex.what() << std::endl;
return -1; return -1;
} catch (...) }
catch (...)
{ {
std::clog << "Exception of unknown type!" << std::endl; std::clog << "Exception of unknown type!" << std::endl;
return -1; return -1;