diff --git a/.clang-format b/.clang-format index 09e930722..65eba7616 100644 --- a/.clang-format +++ b/.clang-format @@ -31,7 +31,7 @@ BraceWrapping: AfterNamespace: false AfterStruct: true AfterExternBlock: false - BeforeCatch: false + BeforeCatch: true BeforeElse: true BeforeLambdaBody: false BeforeWhile: false diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index 593931103..94c785ac5 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -132,7 +132,8 @@ inline int handle_args(int argc, char** argv, mapnik::parameters& params) auto result = run(test_runner, name); \ testing::run_cleanup(); \ return result; \ - } catch (std::exception const& ex) \ + } \ + catch (std::exception const& ex) \ { \ std::clog << ex.what() << "\n"; \ testing::run_cleanup(); \ @@ -263,7 +264,8 @@ int run(T const& test_runner, std::string const& name) ips.u); std::clog << msg; return 0; - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << "test runner did not complete: " << ex.what() << "\n"; return 4; diff --git a/benchmark/src/test_getline.cpp b/benchmark/src/test_getline.cpp index 305d1b530..7320d9271 100644 --- a/benchmark/src/test_getline.cpp +++ b/benchmark/src/test_getline.cpp @@ -114,7 +114,8 @@ int main(int argc, char** argv) test2 test_runner2(params); 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"; return -1; diff --git a/benchmark/src/test_numeric_cast_vs_static_cast.cpp b/benchmark/src/test_numeric_cast_vs_static_cast.cpp index 542006910..1b28513f2 100644 --- a/benchmark/src/test_numeric_cast_vs_static_cast.cpp +++ b/benchmark/src/test_numeric_cast_vs_static_cast.cpp @@ -59,10 +59,12 @@ class test_numeric : public benchmark::test_case try { x = boost::numeric_cast(start_ * value_); - } catch (negative_overflow&) + } + catch (negative_overflow&) { x = std::numeric_limits::min(); - } catch (positive_overflow&) + } + catch (positive_overflow&) { x = std::numeric_limits::max(); } diff --git a/benchmark/src/test_rendering.cpp b/benchmark/src/test_rendering.cpp index 0ba1fdff4..3764f946c 100644 --- a/benchmark/src/test_rendering.cpp +++ b/benchmark/src/test_rendering.cpp @@ -112,7 +112,8 @@ int main(int argc, char** argv) test test_runner(params); return_value = run(test_runner, *name); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; return -1; diff --git a/benchmark/src/test_rendering_shared_map.cpp b/benchmark/src/test_rendering_shared_map.cpp index 3d16f61fd..43ae727b9 100644 --- a/benchmark/src/test_rendering_shared_map.cpp +++ b/benchmark/src/test_rendering_shared_map.cpp @@ -167,7 +167,8 @@ int main(int argc, char** argv) test test_runner(params); return_value = run(test_runner, *name); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; return -1; diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index dc4f8e823..c5b56cb3c 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -370,11 +370,13 @@ int main(int, char**) #endif // save map definition (data + style) save_map(m, "map.xml"); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << "### std::exception: " << ex.what() << std::endl; return EXIT_FAILURE; - } catch (...) + } + catch (...) { std::cerr << "### Unknown exception." << std::endl; return EXIT_FAILURE; diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index 09e90fac3..aa73b9ce3 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -85,7 +85,8 @@ int main(int argc, char** argv) window.set_scaling_factor(scaling_factor); } return app.exec(); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << "Could not start viewer: '" << ex.what() << "'\n"; return 1; diff --git a/demo/viewer/mainwindow.cpp b/demo/viewer/mainwindow.cpp index 9253a25fa..753b1286b 100644 --- a/demo/viewer/mainwindow.cpp +++ b/demo/viewer/mainwindow.cpp @@ -189,10 +189,12 @@ void MainWindow::load_map_file(QString const& filename) { mapnik::auto_cpu_timer t(std::clog, "loading map took: "); mapnik::load_map(*map, filename.toStdString()); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cout << ex.what() << "\n"; - } catch (...) + } + catch (...) { 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_); std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl; } - } catch (...) + } + catch (...) {} } diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index ba3e1c000..184b928c4 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -513,7 +513,8 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap& pix) catch (std::exception const& ex) { std::cerr << "exception: " << ex.what() << std::endl; - } catch (...) + } + catch (...) { std::cerr << "Unknown exception caught!\n"; } @@ -602,7 +603,8 @@ void MapWidget::updateMap() update(); // emit signal to interested widgets emit mapViewChanged(); - } catch (...) + } + catch (...) { std::cerr << "Unknown exception caught!\n"; } diff --git a/include/mapnik/evaluate_global_attributes.hpp b/include/mapnik/evaluate_global_attributes.hpp index 8ec188460..a2e298789 100644 --- a/include/mapnik/evaluate_global_attributes.hpp +++ b/include/mapnik/evaluate_global_attributes.hpp @@ -230,7 +230,8 @@ struct assign_value try { val = parse_color(str); - } catch (...) + } + catch (...) { val = color(0, 0, 0); } @@ -266,7 +267,8 @@ std::tuple pre_evaluate_expression(expression_ptr const& expr) { return std::make_tuple(util::apply_visitor(mapnik::evaluate_expression(boost::none), *expr), true); - } catch (...) + } + catch (...) { return std::make_tuple(T(), false); } diff --git a/include/mapnik/geometry/centroid.hpp b/include/mapnik/geometry/centroid.hpp index 52c7d2feb..ad562c391 100644 --- a/include/mapnik/geometry/centroid.hpp +++ b/include/mapnik/geometry/centroid.hpp @@ -75,7 +75,8 @@ struct geometry_centroid { boost::geometry::centroid(geom, pt_); return true; - } catch (boost::geometry::centroid_exception const& e) + } + catch (boost::geometry::centroid_exception const& e) { return false; } diff --git a/include/mapnik/json/unicode_string_grammar_x3_def.hpp b/include/mapnik/json/unicode_string_grammar_x3_def.hpp index b513ae88d..6a8c77eb1 100644 --- a/include/mapnik/json/unicode_string_grammar_x3_def.hpp +++ b/include/mapnik/json/unicode_string_grammar_x3_def.hpp @@ -69,7 +69,8 @@ auto push_utf16 = [](auto const& ctx) { { detail::push_utf8_impl(_val(ctx), *itr); } - } catch (...) + } + catch (...) { // caught } diff --git a/include/mapnik/params_impl.hpp b/include/mapnik/params_impl.hpp index 1d91cc0ec..0429d1b89 100644 --- a/include/mapnik/params_impl.hpp +++ b/include/mapnik/params_impl.hpp @@ -191,7 +191,8 @@ struct value_extractor_visitor try { var_ = boost::lexical_cast(val); - } catch (boost::bad_lexical_cast const&) + } + catch (boost::bad_lexical_cast const&) { std::ostringstream s; s << "Failed converting from " << typeid(T1).name() << " to " << typeid(T).name(); diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index 1ed47327c..f6c93a32b 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -159,7 +159,8 @@ struct enum_traits { \ enum_.from_string(str); \ return result_type(e(enum_)); \ - } catch (...) \ + } \ + catch (...) \ { \ return result_type(); \ } \ diff --git a/include/mapnik/symbolizer_utils.hpp b/include/mapnik/symbolizer_utils.hpp index e0d659dcd..8859a5455 100644 --- a/include/mapnik/symbolizer_utils.hpp +++ b/include/mapnik/symbolizer_utils.hpp @@ -363,7 +363,8 @@ struct set_symbolizer_property_impl boost::optional val = node.get_opt_attr(name); if (val) put(sym, key, *val); - } catch (config_error const& ex) + } + catch (config_error const& ex) { // try parsing as an expression boost::optional val = node.get_opt_attr(name); diff --git a/include/mapnik/text/properties_util.hpp b/include/mapnik/text/properties_util.hpp index 5d81d0886..1cd4a0136 100644 --- a/include/mapnik/text/properties_util.hpp +++ b/include/mapnik/text/properties_util.hpp @@ -63,7 +63,8 @@ struct set_property_from_xml_impl boost::optional val_ = node.get_opt_attr(name); if (val_) val = *val_; - } catch (config_error const& ex) + } + catch (config_error const& ex) { boost::optional val_ = node.get_opt_attr(name); if (val_) @@ -88,7 +89,8 @@ struct set_property_from_xml_impl boost::optional val_ = node.get_opt_attr(name); if (val_) val = *val_; - } catch (config_error const& ex) + } + catch (config_error const& ex) { boost::optional val_ = node.get_opt_attr(name); if (val_) @@ -117,7 +119,8 @@ struct set_property_from_xml_impl e.from_string(*enum_str); val = enumeration_wrapper(e); } - } catch (...) + } + catch (...) { boost::optional expr = node.get_opt_attr(name); if (expr) diff --git a/include/mapnik/timer.hpp b/include/mapnik/timer.hpp index bea1b4c6a..074839f0c 100644 --- a/include/mapnik/timer.hpp +++ b/include/mapnik/timer.hpp @@ -135,7 +135,8 @@ class progress_timer : public timer s << wall_clock_elapsed() << "ms (cpu " << cpu_elapsed() << "ms)"; s << std::setw(30 - (int)s.tellp()) << std::right << "| " << base_message_ << "\n"; os_ << s.str(); - } catch (...) + } + catch (...) {} // eat any exceptions } diff --git a/include/mapnik/xml_attribute_cast.hpp b/include/mapnik/xml_attribute_cast.hpp index 815deb476..a2b434ea5 100644 --- a/include/mapnik/xml_attribute_cast.hpp +++ b/include/mapnik/xml_attribute_cast.hpp @@ -174,7 +174,8 @@ struct do_xml_attribute_cast> mapnik::enumeration e; e.from_string(source); 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(); return result_type(); diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index fec88f702..1a0d36461 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -284,7 +284,8 @@ boost::optional csv_datasource::get_geometry_type } multi_type = type; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { if (strict_) throw ex; @@ -330,7 +331,8 @@ boost::optional csv_datasource::get_geometry_type } multi_type = type; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { if (strict_) throw ex; diff --git a/plugins/input/csv/csv_utils.cpp b/plugins/input/csv/csv_utils.cpp index d06968429..382b1ce2d 100644 --- a/plugins/input/csv/csv_utils.cpp +++ b/plugins/input/csv/csv_utils.cpp @@ -329,7 +329,8 @@ void csv_file_parser::parse_csv_and_boxes(std::istream& csv_file, T& boxes) ++line_number; break; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::string s("CSV Plugin: error parsing headers: "); 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) << "'"; throw mapnik::datasource_exception(s.str()); } - } catch (mapnik::datasource_exception const& ex) + } + catch (mapnik::datasource_exception const& ex) { if (strict_) 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; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::ostringstream s; s << "CSV Plugin: unexpected error parsing line: " << line_number << " - found " << headers_.size() diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 5a50f9c40..b811e9d8d 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -215,7 +215,8 @@ void geojson_datasource::initialise_disk_index(std::string const& filename) try { mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { 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 { parse_feature(start, end, feature, tr); - } catch (...) + } + catch (...) { start = itr; parse_geometry(start, end, feature); @@ -278,14 +280,16 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end) try { mapnik::json::parse_feature(itr2, end2, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { throw std::runtime_error("Failed to parse geojson feature"); } initialise_descriptor(feature); } } - } catch (...) + } + catch (...) { cache_features_ = true; // force caching single feature itr = start; // reset iteraror @@ -294,7 +298,8 @@ void geojson_datasource::initialise_index(Iterator start, Iterator end) try { mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { if (from_inline_string_) 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); features_.push_back(std::move(feature)); } - } catch (...) + } + catch (...) { itr = start; // try parsing as single Feature or single Geometry JSON @@ -366,7 +372,8 @@ void geojson_datasource::parse_geojson(Iterator start, Iterator end) try { mapnik::json::parse_geometry_or_feature(itr, end, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { if (from_inline_string_) throw mapnik::datasource_exception( @@ -468,7 +475,8 @@ boost::optional geojson_datasource::get_geometry_ try { mapnik::json::parse_feature(start, end, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { throw std::runtime_error("Failed to parse geojson feature"); } @@ -531,7 +539,8 @@ boost::optional geojson_datasource::get_geometry_ try { mapnik::json::parse_feature(start2, end2, *feature, geojson_datasource_static_tr); - } catch (...) + } + catch (...) { throw std::runtime_error("Failed to parse geojson feature"); } diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 0843bdf83..4428cfc06 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -253,7 +253,8 @@ pgraster_datasource::pgraster_datasource(parameters const& params) MAPNIK_LOG_DEBUG(pgraster) << "pgraster_datasource: no response from metadata query " << s.str(); } 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 MAPNIK_LOG_WARN(pgraster) << "pgraster_datasource: metadata query failed: " << ex.what(); @@ -562,7 +563,8 @@ pgraster_datasource::~pgraster_datasource() { conn->close(); } - } catch (mapnik::datasource_exception const& ex) + } + catch (mapnik::datasource_exception const& ex) { // happens when borrowObject tries to // create a new connection and fails. diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index 5c29a64be..9b236e149 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -206,7 +206,8 @@ postgis_datasource::postgis_datasource(parameters const& params) } } 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 MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); @@ -470,7 +471,8 @@ postgis_datasource::~postgis_datasource() { conn->close(); } - } catch (mapnik::datasource_exception const& ex) + } + catch (mapnik::datasource_exception const& ex) { // happens when borrowObject tries to // create a new connection and fails. @@ -1112,7 +1114,8 @@ boost::optional postgis_datasource::get_geometry_ 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 MAPNIK_LOG_WARN(postgis) << "postgis_datasource: metadata query failed: " << ex.what(); diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 281148f1a..3c136cb88 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -136,13 +136,16 @@ raster_datasource::raster_datasource(parameters const& params) width_ = reader->width(); 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())); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { throw datasource_exception("Raster Plugin: " + std::string(ex.what())); - } catch (...) + } + catch (...) { throw datasource_exception("Raster Plugin: image reader unknown exception caught"); } diff --git a/plugins/input/raster/raster_featureset.cpp b/plugins/input/raster/raster_featureset.cpp index 39729f5b1..905d1946c 100644 --- a/plugins/input/raster/raster_featureset.cpp +++ b/plugins/input/raster/raster_featureset.cpp @@ -130,13 +130,16 @@ feature_ptr raster_featureset::next() 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(); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { MAPNIK_LOG_ERROR(raster) << "Raster Plugin: " << ex.what(); - } catch (...) + } + catch (...) { MAPNIK_LOG_ERROR(raster) << "Raster Plugin: exception caught"; } diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index d7e66e7ee..df96d6684 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -141,15 +141,18 @@ shape_datasource::shape_datasource(parameters const& params) break; } } - } catch (datasource_exception const& ex) + } + catch (datasource_exception const& ex) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); throw; - } catch (const std::exception& ex) + } + catch (const std::exception& ex) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing field attributes, " << ex.what(); 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"; throw; diff --git a/plugins/input/shape/shape_featureset.cpp b/plugins/input/shape/shape_featureset.cpp index afe4f4ff5..217286550 100644 --- a/plugins/input/shape/shape_featureset.cpp +++ b/plugins/input/shape/shape_featureset.cpp @@ -150,7 +150,8 @@ feature_ptr shape_featureset::next() { shape_.dbf().add_attribute(id, *tr_, *feature); // TODO optimize!!! } - } catch (...) + } + catch (...) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; } diff --git a/plugins/input/shape/shape_index_featureset.cpp b/plugins/input/shape/shape_index_featureset.cpp index bb2f7cdce..bd75e0bdb 100644 --- a/plugins/input/shape/shape_index_featureset.cpp +++ b/plugins/input/shape/shape_index_featureset.cpp @@ -181,7 +181,8 @@ feature_ptr shape_index_featureset::next() { shape_ptr_->dbf().add_attribute(id, *tr_, *feature); } - } catch (...) + } + catch (...) { MAPNIK_LOG_ERROR(shape) << "Shape Plugin: error processing attributes"; } diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index 14eebb7df..136e16f26 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -53,7 +53,8 @@ shape_io::shape_io(std::string const& shape_name, bool open_index) try { index_ = std::make_unique(shape_name + INDEX); - } catch (...) + } + catch (...) { MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX; } diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index 636b49d0e..0a2f942dd 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -295,14 +295,16 @@ class sqlite_utils one_success = true; } } - } catch (mapnik::datasource_exception const& ex) + } + catch (mapnik::datasource_exception const& ex) { if (!existed) { try { mapnik::util::remove(index_db); - } catch (...) + } + catch (...) {}; } throw mapnik::datasource_exception(ex.what()); @@ -318,7 +320,8 @@ class sqlite_utils try { mapnik::util::remove(index_db); - } catch (...) + } + catch (...) {}; } return false; @@ -418,14 +421,16 @@ class sqlite_utils ps.step_next(); one_success = true; } - } catch (mapnik::datasource_exception const& ex) + } + catch (mapnik::datasource_exception const& ex) { if (!existed) { try { mapnik::util::remove(index_db); - } catch (...) + } + catch (...) {}; } throw mapnik::datasource_exception(ex.what()); @@ -441,7 +446,8 @@ class sqlite_utils try { mapnik::util::remove(index_db); - } catch (...) + } + catch (...) {}; } return false; @@ -517,7 +523,8 @@ class sqlite_utils { return true; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { MAPNIK_LOG_DEBUG(sqlite) << "has_rtree returned:" << ex.what(); return false; diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 993c5f9ef..b704c4eee 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -174,7 +174,8 @@ void topojson_datasource::parse_topojson(T const& buffer) try { boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo_); - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { std::clog << "failed to parse TopoJSON..." << std::endl; std::clog << ex.what() << std::endl; diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 4b08a2b7c..54871f7f3 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -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(); } @@ -236,7 +237,8 @@ bool datasource_cache::register_datasource(std::string const& filename) << "Problem loading plugin library: " << filename << " (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) << "Exception caught while loading plugin library: " << filename << " (" << ex.what() << ")"; diff --git a/src/expression.cpp b/src/expression.cpp index 391e3e21a..2a42a3358 100644 --- a/src/expression.cpp +++ b/src/expression.cpp @@ -46,11 +46,13 @@ expression_ptr parse_expression(std::string const& str) try { r = boost::spirit::x3::phrase_parse(itr, end, parser, space, *node); - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { // no need to show "boost::spirit::x3::expectation_failure" which is a std::runtime_error 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 throw config_error(std::string(ex.what()) + " for expression: \"" + str + "\""); diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 4f27df10e..c905aaedd 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -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(); } diff --git a/src/image_options.cpp b/src/image_options.cpp index 694c82327..6cea2e300 100644 --- a/src/image_options.cpp +++ b/src/image_options.cpp @@ -75,7 +75,8 @@ image_options_map parse_image_options(std::string const& str) { throw std::runtime_error("Can't parse image options: " + str); } - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { 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); } - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { throw std::runtime_error("Can't parse PNG filters: " + str + " " + ex.what()); } diff --git a/src/json/feature_from_geojson.cpp b/src/json/feature_from_geojson.cpp index 7cbcb5d7f..385744b8b 100644 --- a/src/json/feature_from_geojson.cpp +++ b/src/json/feature_from_geojson.cpp @@ -34,7 +34,8 @@ bool from_geojson(std::string const& json, feature_impl& feature) const char* start = json.c_str(); const char* end = start + json.length(); mapnik::json::parse_feature(start, end, feature); - } catch (...) + } + catch (...) { return false; } diff --git a/src/json/geometry_from_geojson.cpp b/src/json/geometry_from_geojson.cpp index d06098cb6..d4594ba97 100644 --- a/src/json/geometry_from_geojson.cpp +++ b/src/json/geometry_from_geojson.cpp @@ -41,7 +41,8 @@ bool from_geojson(std::string const& json, mapnik::geometry::geometry& g { throw std::runtime_error("Can't parser GeoJSON Geometry"); } - } catch (...) + } + catch (...) { return false; } diff --git a/src/load_map.cpp b/src/load_map.cpp index 17dd772e2..12833e568 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -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 projection proj(srs, true); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { 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); throw; } 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."); } @@ -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); 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; } } - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(std::string("in style '") + name + "'", node); throw; @@ -611,7 +616,8 @@ void map_parser::parse_fontset(Map& map, xml_node const& node) // when it's parsed fontsets_.emplace(name, 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); 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 projection proj(srs, true); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { throw mapnik::config_error(ex.what()); } @@ -860,10 +867,12 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node) { std::shared_ptr ds = datasource_cache::instance().create(params); lyr.set_datasource(ds); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { throw config_error(ex.what()); - } catch (...) + } + catch (...) { throw config_error("Unknown exception occurred attempting to create datasoure for layer '" + lyr.name() + "'"); @@ -875,7 +884,8 @@ void map_parser::parse_layer(Parent& parent, xml_node const& node) } } parent.add_layer(std::move(lyr)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { if (!name.empty()) { @@ -923,8 +933,8 @@ void map_parser::parse_rule(feature_type_style& style, xml_node const& node) parse_symbolizers(rule, node); style.add_rule(std::move(rule)); - - } catch (config_error const& ex) + } + catch (config_error const& ex) { if (!name.empty()) { @@ -1043,7 +1053,8 @@ void map_parser::parse_point_symbolizer(rule& rule, xml_node const& node) } rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1061,7 +1072,8 @@ void map_parser::parse_dot_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::height, node); set_symbolizer_property(sym, keys::comp_op, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1136,7 +1148,8 @@ void map_parser::parse_markers_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::direction, node); parse_stroke(sym, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1180,7 +1193,8 @@ void map_parser::parse_line_pattern_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::line_pattern, node); set_symbolizer_property(sym, keys::alignment, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1220,7 +1234,8 @@ void map_parser::parse_polygon_pattern_symbolizer(rule& rule, xml_node const& no set_symbolizer_property(sym, keys::alignment, node); set_symbolizer_property(sym, keys::gamma_method, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1257,7 +1272,8 @@ void map_parser::parse_text_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::offset, node); rule.append(std::move(sym)); } - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1332,7 +1348,8 @@ void map_parser::parse_shield_symbolizer(rule& rule, xml_node const& node) if (halo_rasterizer_) put(sym, keys::halo_rasterizer, halo_rasterizer_enum(*halo_rasterizer_)); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1363,7 +1380,8 @@ void map_parser::parse_line_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::offset, node); set_symbolizer_property(sym, keys::line_rasterizer, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1381,7 +1399,8 @@ void map_parser::parse_polygon_symbolizer(rule& rule, xml_node const& node) set_symbolizer_property(sym, keys::gamma, node); set_symbolizer_property(sym, keys::gamma_method, node); rule.append(std::move(sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1401,7 +1420,8 @@ void map_parser::parse_building_symbolizer(rule& rule, xml_node const& node) if (height) put(building_sym, keys::height, *height); rule.append(std::move(building_sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1492,7 +1512,8 @@ void map_parser::parse_raster_symbolizer(rule& rule, xml_node const& node) put(raster_sym, keys::colorizer, colorizer); } rule.append(std::move(raster_sym)); - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1540,7 +1561,8 @@ void map_parser::parse_group_symbolizer(rule& rule, xml_node const& node) } put(symbol, keys::group_properties, prop); rule.append(std::move(symbol)); - } catch (const config_error& ex) + } + catch (const config_error& ex) { ex.append_context(node); throw; @@ -1635,7 +1657,8 @@ bool map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc, xml_node rc->add_stop(stop); } } - } catch (config_error const& ex) + } + catch (config_error const& ex) { ex.append_context(node); throw; @@ -1676,7 +1699,8 @@ void map_parser::parse_group_rule(group_symbolizer_properties& prop, xml_node co } prop.add_rule(std::move(rule)); - } catch (const config_error& ex) + } + catch (const config_error& ex) { ex.append_context(node); throw; diff --git a/src/map.cpp b/src/map.cpp index 143d3c2e3..ac77218cc 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -559,7 +559,8 @@ void Map::zoom_all() 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()); } diff --git a/src/mapped_memory_cache.cpp b/src/mapped_memory_cache.cpp index cf30d7458..8da68a1c5 100644 --- a/src/mapped_memory_cache.cpp +++ b/src/mapped_memory_cache.cpp @@ -91,7 +91,8 @@ boost::optional mapped_memory_cache::find(std::string const& cache_.emplace(uri, *result); } return result; - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { MAPNIK_LOG_ERROR(mapped_memory_cache) << "Error loading mapped memory file: '" << uri << "' (" << ex.what() << ")"; diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index d6b72775e..06cd5f45f 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -270,7 +270,8 @@ std::shared_ptr 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() << ")"; } diff --git a/src/parse_image_filters.cpp b/src/parse_image_filters.cpp index 27dc89499..e245451ec 100644 --- a/src/parse_image_filters.cpp +++ b/src/parse_image_filters.cpp @@ -41,7 +41,8 @@ bool parse_image_filters(std::string const& str, std::vector& image try { r = boost::spirit::x3::phrase_parse(itr, end, grammar, space, image_filters); - } catch (...) + } + catch (...) { image_filters.clear(); r = false; diff --git a/src/parse_transform.cpp b/src/parse_transform.cpp index 1d8df491b..5ba49995e 100644 --- a/src/parse_transform.cpp +++ b/src/parse_transform.cpp @@ -48,7 +48,8 @@ transform_list_ptr parse_transform(std::string const& str, std::string const& en try { status = boost::spirit::x3::phrase_parse(itr, end, parser, space, *trans_list); - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { throw config_error("Failed to parse transform expression: \"" + str + "\""); } diff --git a/src/rapidxml_loader.cpp b/src/rapidxml_loader.cpp index 0e7a3ec24..5056e4ba8 100644 --- a/src/rapidxml_loader.cpp +++ b/src/rapidxml_loader.cpp @@ -97,7 +97,8 @@ class rapidxml_loader : util::noncopyable { populate_tree(child, node); } - } catch (rapidxml::parse_error const& e) + } + catch (rapidxml::parse_error const& e) { long line = static_cast(std::count(&array.front(), e.where(), '\n') + 1); throw config_error(e.what(), line, filename_); diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 061ed621c..9e2f7c8a4 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -212,7 +212,8 @@ mapnik::color parse_color(T& err_handler, const char* str) try { 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 with value \"" + std::string(str) + "\""); } @@ -383,7 +384,8 @@ std::pair parse_preserve_aspect_ratio(T& err_handler, char const -x3::lit("defer") // only applicable to which we don't support currently > align[apply_align] > -(x3::lit("meet") | x3::lit("slice")[apply_slice]), x3::space); - } catch (x3::expectation_failure const& ex) + } + catch (x3::expectation_failure const& ex) { err_handler.on_error("SVG parse error: failed to parse with value \"" + std::string(str) + "\""); @@ -1671,7 +1673,8 @@ void svg_parser::parse(std::string const& filename) try { doc.parse(buffer.data()); - } catch (rapidxml::parse_error const& ex) + } + catch (rapidxml::parse_error const& ex) { std::stringstream ss; ss << "SVG error: unable to parse \"" << filename << "\""; @@ -1693,7 +1696,8 @@ void svg_parser::parse_from_string(std::string const& svg) try { doc.parse(buffer.data()); - } catch (rapidxml::parse_error const& ex) + } + catch (rapidxml::parse_error const& ex) { std::stringstream ss; std::string str = (svg.length() > 1024) ? svg.substr(0, 1024) + "..." : svg; diff --git a/src/svg/svg_path_parser.cpp b/src/svg/svg_path_parser.cpp index 19e4d994e..c241e4119 100644 --- a/src/svg/svg_path_parser.cpp +++ b/src/svg/svg_path_parser.cpp @@ -53,7 +53,8 @@ bool parse_path(const char* wkt, PathType& p) { throw std::runtime_error("Failed to parse svg-path"); } - } catch (...) + } + catch (...) { return false; } diff --git a/src/svg/svg_points_parser.cpp b/src/svg/svg_points_parser.cpp index 944ed6954..d1af8b012 100644 --- a/src/svg/svg_points_parser.cpp +++ b/src/svg/svg_points_parser.cpp @@ -53,7 +53,8 @@ bool parse_points(const char* wkt, PathType& p) { throw std::runtime_error("Failed to parse svg-path"); } - } catch (...) + } + catch (...) { return false; } diff --git a/src/svg/svg_transform_parser.cpp b/src/svg/svg_transform_parser.cpp index 97e81d412..4eb1bd3f7 100644 --- a/src/svg/svg_transform_parser.cpp +++ b/src/svg/svg_transform_parser.cpp @@ -53,7 +53,8 @@ bool parse_svg_transform(const char* wkt, Transform& tr) { throw std::runtime_error("Failed to parse svg-transform"); } - } catch (...) + } + catch (...) { return false; } diff --git a/src/text/placements/simple.cpp b/src/text/placements/simple.cpp index f2dad1675..cf3610328 100644 --- a/src/text/placements/simple.cpp +++ b/src/text/placements/simple.cpp @@ -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); return ptr; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { // otherwise ensure it is valid std::vector direction; diff --git a/src/wkt/wkt_factory.cpp b/src/wkt/wkt_factory.cpp index 6da04083c..454f608d9 100644 --- a/src/wkt/wkt_factory.cpp +++ b/src/wkt/wkt_factory.cpp @@ -36,7 +36,8 @@ bool from_wkt(std::string const& wkt, mapnik::geometry::geometry& geom) try { result = x3::phrase_parse(itr, end, grammar::wkt, space, geom); - } catch (x3::expectation_failure const& ex) + } + catch (x3::expectation_failure const& ex) { return false; } diff --git a/test/catch.hpp b/test/catch.hpp index 896ad6382..2fbb4a76b 100644 --- a/test/catch.hpp +++ b/test/catch.hpp @@ -3503,7 +3503,8 @@ class Capturer { \ static_cast(__VA_ARGS__); \ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ - } catch (...) \ + } \ + catch (...) \ { \ catchAssertionHandler.handleUnexpectedInflightException(); \ } \ @@ -3523,7 +3524,8 @@ class Capturer { \ static_cast(__VA_ARGS__); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } catch (...) \ + } \ + catch (...) \ { \ catchAssertionHandler.handleExceptionThrownAsExpected(); \ } \ @@ -3546,10 +3548,12 @@ class Capturer { \ static_cast(expr); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } catch (exceptionType const&) \ + } \ + catch (exceptionType const&) \ { \ catchAssertionHandler.handleExceptionThrownAsExpected(); \ - } catch (...) \ + } \ + catch (...) \ { \ catchAssertionHandler.handleUnexpectedInflightException(); \ } \ @@ -3602,7 +3606,8 @@ class Capturer { \ static_cast(__VA_ARGS__); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } catch (...) \ + } \ + catch (...) \ { \ Catch::handleExceptionMatchExpr(catchAssertionHandler, matcher, #matcher##_catch_sr); \ } \ @@ -3849,7 +3854,8 @@ class ExceptionTranslatorRegistrar std::rethrow_exception(std::current_exception()); else return (*it)->translate(it + 1, itEnd); - } catch (T& ex) + } + catch (T& ex) { return m_translateFunction(ex); } @@ -4727,10 +4733,12 @@ auto makeMatchExpr(ArgT const& arg, MatcherT const& matcher, StringRef const& ma { \ static_cast(__VA_ARGS__); \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ - } catch (exceptionType const& ex) \ + } \ + catch (exceptionType const& ex) \ { \ catchAssertionHandler.handleExpr(Catch::makeMatchExpr(ex, matcher, #matcher##_catch_sr)); \ - } catch (...) \ + } \ + catch (...) \ { \ catchAssertionHandler.handleUnexpectedInflightException(); \ } \ @@ -12197,7 +12205,8 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const @try { return tryTranslators(); - } @catch (NSException* exception) + } + @catch (NSException* exception) { return Catch::Detail::stringify([exception description]); } @@ -12216,19 +12225,24 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const } return tryTranslators(); #endif - } catch (TestFailureException&) + } + catch (TestFailureException&) { std::rethrow_exception(std::current_exception()); - } catch (std::exception& ex) + } + catch (std::exception& ex) { return ex.what(); - } catch (std::string& msg) + } + catch (std::string& msg) { return msg; - } catch (const char* msg) + } + catch (const char* msg) { return msg; - } catch (...) + } + catch (...) { return "Unknown exception"; } @@ -15201,7 +15215,8 @@ Session::Session() try { std::rethrow_exception(ex_ptr); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { Catch::cerr() << Column(ex.what()).indent(2) << '\n'; } diff --git a/test/catch_ext.hpp b/test/catch_ext.hpp index 78ed8bf34..12c10138e 100644 --- a/test/catch_ext.hpp +++ b/test/catch_ext.hpp @@ -7,7 +7,8 @@ try \ { \ CHECK(expr); \ - } catch (Catch::TestFailureException&) \ + } \ + catch (Catch::TestFailureException&) \ { \ /* thrown by CHECK after it catches and reports */ \ /* an exception from expr => swallow this */ \ @@ -17,7 +18,8 @@ try \ { \ CHECK_FALSE(expr); \ - } catch (Catch::TestFailureException&) \ + } \ + catch (Catch::TestFailureException&) \ {} #endif // TEST_CATCH_EXT_HPP diff --git a/test/standalone/datasource_registration_test.cpp b/test/standalone/datasource_registration_test.cpp index b93fb03df..9408aba9d 100644 --- a/test/standalone/datasource_registration_test.cpp +++ b/test/standalone/datasource_registration_test.cpp @@ -42,7 +42,8 @@ TEST_CASE("datasource_cache") success = cache.register_datasources("plugins/input", true); CHECK(success == false); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/standalone/font_registration_test.cpp b/test/standalone/font_registration_test.cpp index 5197f57ac..b651d525a 100644 --- a/test/standalone/font_registration_test.cpp +++ b/test/standalone/font_registration_test.cpp @@ -165,7 +165,8 @@ TEST_CASE("font") mapnik::freetype_engine::register_fonts("C:\\Windows\\Fonts", true); face_names = mapnik::freetype_engine::face_names(); REQUIRE(face_names.size() > 22); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index b9755588e..bf0e53253 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -54,13 +54,13 @@ class tmp_dir break; } } - - } catch (const std::exception& e) + } + catch (const std::exception& e) { std::cerr << "Exception caught while trying to remove " << "temporary directory " << m_path << ": " << e.what() << "\n"; - - } catch (...) + } + catch (...) { std::cerr << "Unknown exception caught while trying to " << "remove temporary directory " << m_path << "\n"; @@ -121,7 +121,8 @@ void load_map(mapnik::Map& m, bfs::path const& path) try { 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 // database not being set up aren't really useful - they're diff --git a/test/unit/core/conversions_test.cpp b/test/unit/core/conversions_test.cpp index 6e91c5c2d..786b993b2 100644 --- a/test/unit/core/conversions_test.cpp +++ b/test/unit/core/conversions_test.cpp @@ -300,8 +300,8 @@ TEST_CASE("conversions") mapnik::value streamable(ustr); s << streamable; CHECK(s.str() == std::string("hello world!")); - - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/core/copy_move_test.cpp b/test/unit/core/copy_move_test.cpp index b31e41e04..44c72441f 100644 --- a/test/unit/core/copy_move_test.cpp +++ b/test/unit/core/copy_move_test.cpp @@ -68,7 +68,8 @@ TEST_CASE("copy") REQUIRE((m0 == m2)); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/core/exceptions_test.cpp b/test/unit/core/exceptions_test.cpp index a5c6db81e..5982054c3 100644 --- a/test/unit/core/exceptions_test.cpp +++ b/test/unit/core/exceptions_test.cpp @@ -30,7 +30,8 @@ TEST_CASE("exceptions") // to avoid unused variable warning srs.params(); REQUIRE(false); - } catch (...) + } + catch (...) { REQUIRE(true); } @@ -44,7 +45,8 @@ TEST_CASE("exceptions") srs.init_proj(); // oddly init_proj does not throw with old proj/ubuntu precise // REQUIRE(false); - } catch (...) + } + catch (...) { REQUIRE(true); } @@ -53,7 +55,8 @@ TEST_CASE("exceptions") { mapnik::transcoder tr("bogus encoding"); REQUIRE(false); - } catch (...) + } + catch (...) { REQUIRE(true); } @@ -88,7 +91,8 @@ TEST_CASE("exceptions") // should throw here with "CSV Plugin: no attribute 'foo'. Valid attributes are: x,y." ren.apply(); REQUIRE(false); - } catch (...) + } + catch (...) { REQUIRE(true); } @@ -104,7 +108,8 @@ TEST_CASE("exceptions") p2["file"] = "foo"; mapnik::datasource_cache::instance().create(p2); REQUIRE(false); - } catch (...) + } + catch (...) { REQUIRE(true); } diff --git a/test/unit/core/params_test.cpp b/test/unit/core/params_test.cpp index c83aea3be..2b19245f6 100644 --- a/test/unit/core/params_test.cpp +++ b/test/unit/core/params_test.cpp @@ -103,7 +103,8 @@ TEST_CASE("parameters") params["member"] = holder_member; REQUIRE((params.get("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"; REQUIRE(false); diff --git a/test/unit/datasource/topojson.cpp b/test/unit/datasource/topojson.cpp index 29a884beb..dd96f6893 100644 --- a/test/unit/datasource/topojson.cpp +++ b/test/unit/datasource/topojson.cpp @@ -60,7 +60,8 @@ bool parse_topology_string(std::string const& buffer, mapnik::topojson::topology try { boost::spirit::x3::phrase_parse(itr, end, mapnik::json::grammar::topology, space_type(), topo); - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { std::cerr << "failed to parse TopoJSON..." << std::endl; std::cerr << ex.what() << std::endl; diff --git a/test/unit/font/fontset_runtime_test.cpp b/test/unit/font/fontset_runtime_test.cpp index d543d8366..a60f6b203 100644 --- a/test/unit/font/fontset_runtime_test.cpp +++ b/test/unit/font/fontset_runtime_test.cpp @@ -64,7 +64,8 @@ TEST_CASE("fontset") mapnik::image_rgba8 buf(m.width(), m.height()); mapnik::agg_renderer ren(m, buf); ren.apply(); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(std::string(ex.what()) == std::string("Unable to find specified font face 'DejaVu Sans Book' in font set: 'fontset'")); diff --git a/test/unit/imaging/image_io_test.cpp b/test/unit/imaging/image_io_test.cpp index 88a1b66a3..3beaf1264 100644 --- a/test/unit/imaging/image_io_test.cpp +++ b/test/unit/imaging/image_io_test.cpp @@ -80,7 +80,8 @@ TEST_CASE("image io") { std::unique_ptr reader(mapnik::get_image_reader(should_throw, *type)); REQUIRE(false); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE( std::string(ex.what()) == @@ -132,7 +133,8 @@ TEST_CASE("image io") REQUIRE(type); REQUIRE_THROWS(mapnik::get_image_reader(should_throw, *type)); #endif - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/imaging/image_painted_test.cpp b/test/unit/imaging/image_painted_test.cpp index 6906897e1..792ec644c 100644 --- a/test/unit/imaging/image_painted_test.cpp +++ b/test/unit/imaging/image_painted_test.cpp @@ -62,7 +62,8 @@ TEST_CASE("image") REQUIRE(image.painted() == true); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << std::endl; REQUIRE(false); diff --git a/test/unit/pixel/agg_blend_src_over_test.cpp b/test/unit/pixel/agg_blend_src_over_test.cpp index 8fb8b8b25..2f3b76c4f 100644 --- a/test/unit/pixel/agg_blend_src_over_test.cpp +++ b/test/unit/pixel/agg_blend_src_over_test.cpp @@ -187,7 +187,8 @@ TEST_CASE("blending") REQUIRE( to_string(blend(source,dest,cover)) == expected_str ); } */ - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/serialization/wkb_formats_test.cpp b/test/unit/serialization/wkb_formats_test.cpp index 473823fea..f5d8ffb6f 100644 --- a/test/unit/serialization/wkb_formats_test.cpp +++ b/test/unit/serialization/wkb_formats_test.cpp @@ -104,7 +104,6 @@ TEST_CASE("geometry formats") sizeof(sq_invalid_blob) / sizeof(sq_invalid_blob[0]), mapnik::wkbGeneric); REQUIRE(geom.is()); // returns geometry_empty - } catch (std::exception const& ex) { diff --git a/test/unit/serialization/wkb_test.cpp b/test/unit/serialization/wkb_test.cpp index 6073c0a93..5d7a2d48d 100644 --- a/test/unit/serialization/wkb_test.cpp +++ b/test/unit/serialization/wkb_test.cpp @@ -16,7 +16,6 @@ #include #include - namespace { struct spatially_equal_visitor @@ -98,7 +97,6 @@ bool spatially_equal(mapnik::geometry::geometry const& g0, mapnik::geometry:: } // namespace - TEST_CASE("Well-known-geometries") { SECTION("wkb+wkt") diff --git a/test/unit/svg/svg_parser_test.cpp b/test/unit/svg/svg_parser_test.cpp index 042178095..10f8ff406 100644 --- a/test/unit/svg/svg_parser_test.cpp +++ b/test/unit/svg/svg_parser_test.cpp @@ -89,7 +89,8 @@ TEST_CASE("SVG parser") try { p->parse(svg_name); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == join(expected_errors)); } @@ -109,7 +110,8 @@ TEST_CASE("SVG parser") try { p->parse_from_string(svg_str); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == join(expected_errors)); } @@ -124,7 +126,8 @@ TEST_CASE("SVG parser") try { p->parse(svg_name); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == join(expected_errors)); } @@ -151,7 +154,8 @@ TEST_CASE("SVG parser") try { p->parse_from_string(svg_str); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == std::string(expected_errors[0])); } @@ -192,7 +196,8 @@ TEST_CASE("SVG parser") try { p->parse_from_string(svg_str); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == std::string(expected_errors[0])); } @@ -217,7 +222,8 @@ TEST_CASE("SVG parser") try { p->parse_from_string(svg_str); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == std::string(expected_errors[0])); } @@ -601,7 +607,8 @@ TEST_CASE("SVG parser") try { p->parse(svg_name); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == std::string(expected_errors[0])); } @@ -627,7 +634,8 @@ TEST_CASE("SVG parser") try { p->parse_from_string(svg_str); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { REQUIRE(ex.what() == std::string(expected_errors[0])); } diff --git a/test/unit/symbolizer/symbolizer_test.cpp b/test/unit/symbolizer/symbolizer_test.cpp index f978ab024..847409ea2 100644 --- a/test/unit/symbolizer/symbolizer_test.cpp +++ b/test/unit/symbolizer/symbolizer_test.cpp @@ -19,7 +19,8 @@ TEST_CASE("symbolizer") REQUIRE(sym.properties.count(keys::markers_multipolicy) == static_cast(1)); marker_multi_policy_enum policy_out = get(sym, keys::markers_multipolicy); REQUIRE(policy_out == MARKER_WHOLE_MULTI); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << ex.what() << std::endl; REQUIRE(false); diff --git a/test/unit/vertex_adapter/clipping_test.cpp b/test/unit/vertex_adapter/clipping_test.cpp index 878204e8e..f1408b3fe 100644 --- a/test/unit/vertex_adapter/clipping_test.cpp +++ b/test/unit/vertex_adapter/clipping_test.cpp @@ -109,7 +109,8 @@ TEST_CASE("clipping") REQUIRE(clip_line(bbox, path) == mapnik::util::trim_copy(parts[2])); } stream.close(); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; } diff --git a/test/unit/vertex_adapter/extend_converter.cpp b/test/unit/vertex_adapter/extend_converter.cpp index fba92e583..ed59e2a27 100644 --- a/test/unit/vertex_adapter/extend_converter.cpp +++ b/test/unit/vertex_adapter/extend_converter.cpp @@ -19,7 +19,8 @@ TEST_CASE("extend converter") mapnik::extend_converter c(path, 1000); double x, y; REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -38,7 +39,8 @@ TEST_CASE("extend converter") 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"; REQUIRE(false); @@ -59,7 +61,8 @@ TEST_CASE("extend converter") REQUIRE(x == 1001); REQUIRE(y == 0); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -83,7 +86,8 @@ TEST_CASE("extend converter") REQUIRE(x == 1002); REQUIRE(y == 0); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -116,7 +120,8 @@ TEST_CASE("extend converter") REQUIRE(x == 1005); REQUIRE(y == 0); REQUIRE(c.vertex(&x, &y) == mapnik::SEG_END); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/vertex_adapter/line_offset_test.cpp b/test/unit/vertex_adapter/line_offset_test.cpp index 5f1158ea8..4871e4588 100644 --- a/test/unit/vertex_adapter/line_offset_test.cpp +++ b/test/unit/vertex_adapter/line_offset_test.cpp @@ -161,7 +161,8 @@ TEST_CASE("offsets") // curve. test_s_shaped_curve(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); diff --git a/test/unit/vertex_adapter/offset_converter.cpp b/test/unit/vertex_adapter/offset_converter.cpp index 513b195dd..f2452e9b8 100644 --- a/test/unit/vertex_adapter/offset_converter.cpp +++ b/test/unit/vertex_adapter/offset_converter.cpp @@ -265,7 +265,8 @@ TEST_CASE("offset converter") // find the correspondance here. offset_test::test_null_segment(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -283,7 +284,8 @@ TEST_CASE("offset converter") // find the correspondance here. offset_test::test_invalid_segment(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -301,7 +303,8 @@ TEST_CASE("offset converter") // find the correspondance here. offset_test::test_simple_segment(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -318,7 +321,8 @@ TEST_CASE("offset converter") // test straight line consisting of more than one segment. offset_test::test_straight_line(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -334,7 +338,8 @@ TEST_CASE("offset converter") { offset_test::test_offset_curve(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); @@ -350,7 +355,8 @@ TEST_CASE("offset converter") { offset_test::test_s_shaped_curve(offset); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::cerr << ex.what() << "\n"; REQUIRE(false); diff --git a/test/visual/run.cpp b/test/visual/run.cpp index d25da763d..846ef6d1c 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -214,7 +214,8 @@ int main(int argc, char** argv) { results = run.test_all(report); } - } catch (std::exception& e) + } + catch (std::exception& e) { std::cerr << "Error running tests: " << e.what() << std::endl; return 1; diff --git a/test/visual/runner.cpp b/test/visual/runner.cpp index 363679188..d538e4522 100644 --- a/test/visual/runner.cpp +++ b/test/visual/runner.cpp @@ -234,7 +234,8 @@ result_list runner::test_range(files_iterator begin, { result_list r = test_one(file, report, fail_count.get()); std::move(r.begin(), r.end(), std::back_inserter(results)); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { result r; r.state = STATE_ERROR; @@ -303,7 +304,8 @@ result_list try { mapnik::load_map(map, style_path.string(), true); - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::string what = ex.what(); if (what.find("Could not create datasource") != std::string::npos || diff --git a/utils/geometry_to_wkb/main.cpp b/utils/geometry_to_wkb/main.cpp index 74d4aa0b6..a31ffc93a 100644 --- a/utils/geometry_to_wkb/main.cpp +++ b/utils/geometry_to_wkb/main.cpp @@ -54,7 +54,8 @@ int main(int argc, char** argv) try { ds = mapnik::datasource_cache::instance().create(p); - } catch (...) + } + catch (...) { std::cerr << "Can't create datasource!\n"; return EXIT_FAILURE; diff --git a/utils/mapnik-index/mapnik-index.cpp b/utils/mapnik-index/mapnik-index.cpp index 895db2714..b7956607a 100644 --- a/utils/mapnik-index/mapnik-index.cpp +++ b/utils/mapnik-index/mapnik-index.cpp @@ -147,7 +147,8 @@ int main(int argc, char** argv) { use_bbox = true; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << "Error: " << ex.what() << std::endl; return EXIT_FAILURE; diff --git a/utils/mapnik-index/process_csv_file.cpp b/utils/mapnik-index/process_csv_file.cpp index 3914f8642..59f1ac1f4 100644 --- a/utils/mapnik-index/process_csv_file.cpp +++ b/utils/mapnik-index/process_csv_file.cpp @@ -54,7 +54,8 @@ std::pair { p.parse_csv_and_boxes(csv_file.file(), boxes); 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; return std::make_pair(false, box_type(p.extent_)); diff --git a/utils/mapnik-index/process_geojson_file_x3.cpp b/utils/mapnik-index/process_geojson_file_x3.cpp index e54a60e2e..93545fb11 100644 --- a/utils/mapnik-index/process_geojson_file_x3.cpp +++ b/utils/mapnik-index/process_geojson_file_x3.cpp @@ -280,13 +280,15 @@ std::pair try { mapnik::json::extract_bounding_boxes(itr, end, boxes); - } catch (boost::spirit::x3::expectation_failure const& ex) + } + catch (boost::spirit::x3::expectation_failure const& ex) { std::clog << ex.what() << std::endl; std::clog << "Expected: " << ex.which(); std::clog << " Got: \"" << std::string(ex.where(), ex.where() + 200) << '"' << std::endl; 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::endl; @@ -324,12 +326,14 @@ std::pair << " size=" << item.second.second << std::endl; return std::make_pair(false, extent); } - } catch (x3::expectation_failure const& ex) + } + catch (x3::expectation_failure const& ex) { if (verbose) std::clog << ex.what() << std::endl; return std::make_pair(false, extent); - } catch (...) + } + catch (...) { if (verbose) std::clog << "Failed to parse: offset=" << item.second.first << " size=" << item.second.second diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index 608dea754..02afc8e0f 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -173,7 +173,8 @@ int main(int argc, char** argv) { std::clog << "rendered to: " << img_file << "\n"; } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << "Error " << ex.what() << std::endl; return -1; diff --git a/utils/ogrindex/ogrindex.cpp b/utils/ogrindex/ogrindex.cpp index f4b39d8fe..0fe3978b4 100644 --- a/utils/ogrindex/ogrindex.cpp +++ b/utils/ogrindex/ogrindex.cpp @@ -101,7 +101,8 @@ int main(int argc, char** argv) { ogr_files = vm["ogr_files"].as>(); } - } catch (...) + } + catch (...) { std::clog << "Exception of unknown type!" << std::endl; return -1; diff --git a/utils/pgsql2sqlite/main.cpp b/utils/pgsql2sqlite/main.cpp index 14a698124..c87692090 100644 --- a/utils/pgsql2sqlite/main.cpp +++ b/utils/pgsql2sqlite/main.cpp @@ -105,12 +105,14 @@ int main(int argc, char** argv) std::cout << "output_table : " << output_table_name << "\n"; mapnik::pgsql2sqlite(conn, query, output_table_name, output_file); - } catch (mapnik::datasource_exception& ex) + } + catch (mapnik::datasource_exception& ex) { std::cerr << ex.what() << "\n"; return EXIT_FAILURE; } - } catch (std::exception& e) + } + catch (std::exception& e) { std::cerr << desc << "\n"; std::cout << usage << "\n"; diff --git a/utils/shapeindex/shapeindex.cpp b/utils/shapeindex/shapeindex.cpp index 914d122d4..f310a572c 100644 --- a/utils/shapeindex/shapeindex.cpp +++ b/utils/shapeindex/shapeindex.cpp @@ -118,7 +118,8 @@ int main(int argc, char** argv) { shape_files = vm["shape_files"].as>(); } - } catch (std::exception const& ex) + } + catch (std::exception const& ex) { std::clog << "Error: " << ex.what() << std::endl; return EXIT_FAILURE; diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 2307781be..281cd67a9 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -242,11 +242,13 @@ int main(int argc, char** argv) main_marker_visitor visitor(svg_name, scale_factor, verbose, auto_open); 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; return -1; - } catch (...) + } + catch (...) { std::clog << "Exception of unknown type!" << std::endl; return -1;