diff --git a/example/example.cpp b/example/example.cpp index c3008f4d2..a48c0b407 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -18,7 +18,7 @@ #include -int main(int argc, const char *argv[]) try +int main(int argc, const char *argv[]) { if (argc < 2) { @@ -78,8 +78,3 @@ int main(int argc, const char *argv[]) try return EXIT_FAILURE; } } -catch (const std::exception &e) -{ - std::cerr << "Error: " << e.what() << std::endl; - return EXIT_FAILURE; -} diff --git a/include/util/static_rtree.hpp b/include/util/static_rtree.hpp index c95515129..96cf01ed2 100644 --- a/include/util/static_rtree.hpp +++ b/include/util/static_rtree.hpp @@ -385,7 +385,7 @@ class StaticRTree std::size_t num_leaves = m_leaves_region.size() / sizeof(LeafNode); m_leaves.reset(reinterpret_cast(m_leaves_region.data()), num_leaves); } - catch (std::exception &exc) + catch (const std::exception &exc) { throw exception(boost::str(boost::format("Leaf file %1% mapping failed: %2%") % leaf_file % exc.what())); diff --git a/src/extractor/extraction_containers.cpp b/src/extractor/extraction_containers.cpp index ba5e81e59..47018bf00 100644 --- a/src/extractor/extraction_containers.cpp +++ b/src/extractor/extraction_containers.cpp @@ -140,28 +140,21 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme const std::string &name_file_name, const std::string &turn_lane_file_name) { - try - { - std::ofstream file_out_stream; - file_out_stream.open(output_file_name.c_str(), std::ios::binary); - const util::FingerPrint fingerprint = util::FingerPrint::GetValid(); - file_out_stream.write((char *)&fingerprint, sizeof(util::FingerPrint)); + std::ofstream file_out_stream; + file_out_stream.open(output_file_name.c_str(), std::ios::binary); + const util::FingerPrint fingerprint = util::FingerPrint::GetValid(); + file_out_stream.write((char *)&fingerprint, sizeof(util::FingerPrint)); - PrepareNodes(); - WriteNodes(file_out_stream); - PrepareEdges(scripting_environment); - WriteEdges(file_out_stream); + PrepareNodes(); + WriteNodes(file_out_stream); + PrepareEdges(scripting_environment); + WriteEdges(file_out_stream); - PrepareRestrictions(); - WriteRestrictions(restrictions_file_name); + PrepareRestrictions(); + WriteRestrictions(restrictions_file_name); - WriteCharData(name_file_name); - WriteTurnLaneMasks(turn_lane_file_name, turn_lane_offsets, turn_lane_masks); - } - catch (const std::exception &e) - { - std::cerr << "Caught Execption:" << e.what() << std::endl; - } + WriteCharData(name_file_name); + WriteTurnLaneMasks(turn_lane_file_name, turn_lane_offsets, turn_lane_masks); } void ExtractionContainers::WriteTurnLaneMasks( diff --git a/src/extractor/extractor.cpp b/src/extractor/extractor.cpp index 41479cf61..25e7c7666 100644 --- a/src/extractor/extractor.cpp +++ b/src/extractor/extractor.cpp @@ -73,7 +73,6 @@ namespace extractor */ int Extractor::run(ScriptingEnvironment &scripting_environment) { - try { util::LogPolicy::GetInstance().Unmute(); TIMER_START(extracting); @@ -202,14 +201,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) << "s"; } - // we do this for scoping - // TODO move to own functions - catch (const std::exception &e) - { - util::SimpleLogger().Write(logWARNING) << e.what(); - return 1; - } - try + { // Transform the node-based graph that OSM is based on into an edge-based graph // that is better for routing. Every edge becomes a node, and every valid @@ -266,11 +258,6 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) util::SimpleLogger().Write() << "To prepare the data for routing, run: " << "./osrm-contract " << config.output_file_name << std::endl; } - catch (const std::exception &e) - { - util::SimpleLogger().Write(logWARNING) << e.what(); - return 1; - } return 0; } diff --git a/src/tools/components.cpp b/src/tools/components.cpp index 71d59f275..9ee2d61f1 100644 --- a/src/tools/components.cpp +++ b/src/tools/components.cpp @@ -228,8 +228,3 @@ int main(int argc, char *argv[]) try osrm::util::SimpleLogger().Write() << "finished component analysis"; return EXIT_SUCCESS; } -catch (const std::exception &e) -{ - osrm::util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index c21af0ca2..264eec716 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -162,8 +162,3 @@ catch (const std::bad_alloc &e) << "Please provide more memory or consider using a larger swapfile"; return EXIT_FAILURE; } -catch (const std::exception &e) -{ - util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/extract.cpp b/src/tools/extract.cpp index a41942780..c24756ba8 100644 --- a/src/tools/extract.cpp +++ b/src/tools/extract.cpp @@ -161,8 +161,3 @@ catch (const std::bad_alloc &e) << "Please provide more memory or consider using a larger swapfile"; return EXIT_FAILURE; } -catch (const std::exception &e) -{ - util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/io-benchmark.cpp b/src/tools/io-benchmark.cpp index 1cabd2bb3..ebbd27b26 100644 --- a/src/tools/io-benchmark.cpp +++ b/src/tools/io-benchmark.cpp @@ -49,7 +49,7 @@ void runStatistics(std::vector &timings_vector, Statistics &stats) boost::filesystem::path test_path; -int main(int argc, char *argv[]) try +int main(int argc, char *argv[]) { #ifdef __FreeBSD__ @@ -312,14 +312,3 @@ int main(int argc, char *argv[]) try return EXIT_SUCCESS; #endif } -catch (const std::exception &e) -{ - osrm::util::SimpleLogger().Write(logWARNING) << "caught exception: " << e.what(); - osrm::util::SimpleLogger().Write(logWARNING) << "cleaning up, and exiting"; - if (boost::filesystem::exists(test_path)) - { - boost::filesystem::remove(test_path); - osrm::util::SimpleLogger().Write(logWARNING) << "removing temporary files"; - } - return EXIT_FAILURE; -} diff --git a/src/tools/routed.cpp b/src/tools/routed.cpp index 612f7dda8..6d0fd0445 100644 --- a/src/tools/routed.cpp +++ b/src/tools/routed.cpp @@ -371,8 +371,3 @@ catch (const std::bad_alloc &e) << "Please provide more memory or consider using a larger swapfile"; return EXIT_FAILURE; } -catch (const std::exception &e) -{ - util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/springclean.cpp b/src/tools/springclean.cpp index 536456bbe..cb5794e9d 100644 --- a/src/tools/springclean.cpp +++ b/src/tools/springclean.cpp @@ -53,7 +53,7 @@ void springclean() } } -int main() try +int main() { osrm::util::LogPolicy::GetInstance().Unmute(); osrm::util::SimpleLogger().Write() << "Releasing all locks"; @@ -74,8 +74,3 @@ int main() try osrm::tools::springclean(); return EXIT_SUCCESS; } -catch (const std::exception &e) -{ - osrm::util::SimpleLogger().Write(logWARNING) << "[excpetion] " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/store.cpp b/src/tools/store.cpp index c249d88db..74c8783f5 100644 --- a/src/tools/store.cpp +++ b/src/tools/store.cpp @@ -99,8 +99,3 @@ catch (const std::bad_alloc &e) "address space (note: this makes OSRM swap, i.e. slow)"; return EXIT_FAILURE; } -catch (const std::exception &e) -{ - util::SimpleLogger().Write(logWARNING) << "caught exception: " << e.what(); - return EXIT_FAILURE; -} diff --git a/src/tools/unlock_all_mutexes.cpp b/src/tools/unlock_all_mutexes.cpp index abb5d860f..556f5b75e 100644 --- a/src/tools/unlock_all_mutexes.cpp +++ b/src/tools/unlock_all_mutexes.cpp @@ -3,7 +3,7 @@ #include -int main() try +int main() { osrm::util::LogPolicy::GetInstance().Unmute(); osrm::util::SimpleLogger().Write() << "Releasing all locks"; @@ -13,8 +13,3 @@ int main() try barrier.update_mutex.unlock(); return 0; } -catch (const std::exception &e) -{ - osrm::util::SimpleLogger().Write(logWARNING) << "[excpetion] " << e.what(); - return EXIT_FAILURE; -}