Remove generic std::exception handlers, they don't seem to be adding value, and they hide useful info.
This commit is contained in:
		
							parent
							
								
									b4710633b1
								
							
						
					
					
						commit
						0b868969be
					
				| @ -18,7 +18,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <cstdlib> | #include <cstdlib> | ||||||
| 
 | 
 | ||||||
| int main(int argc, const char *argv[]) try | int main(int argc, const char *argv[]) | ||||||
| { | { | ||||||
|     if (argc < 2) |     if (argc < 2) | ||||||
|     { |     { | ||||||
| @ -78,8 +78,3 @@ int main(int argc, const char *argv[]) try | |||||||
|         return EXIT_FAILURE; |         return EXIT_FAILURE; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     std::cerr << "Error: " << e.what() << std::endl; |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -385,7 +385,7 @@ class StaticRTree | |||||||
|             std::size_t num_leaves = m_leaves_region.size() / sizeof(LeafNode); |             std::size_t num_leaves = m_leaves_region.size() / sizeof(LeafNode); | ||||||
|             m_leaves.reset(reinterpret_cast<const LeafNode *>(m_leaves_region.data()), num_leaves); |             m_leaves.reset(reinterpret_cast<const LeafNode *>(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%") % |             throw exception(boost::str(boost::format("Leaf file %1% mapping failed: %2%") % | ||||||
|                                        leaf_file % exc.what())); |                                        leaf_file % exc.what())); | ||||||
|  | |||||||
| @ -139,8 +139,6 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme | |||||||
|                                        const std::string &restrictions_file_name, |                                        const std::string &restrictions_file_name, | ||||||
|                                        const std::string &name_file_name, |                                        const std::string &name_file_name, | ||||||
|                                        const std::string &turn_lane_file_name) |                                        const std::string &turn_lane_file_name) | ||||||
| { |  | ||||||
|     try |  | ||||||
| { | { | ||||||
|     std::ofstream file_out_stream; |     std::ofstream file_out_stream; | ||||||
|     file_out_stream.open(output_file_name.c_str(), std::ios::binary); |     file_out_stream.open(output_file_name.c_str(), std::ios::binary); | ||||||
| @ -158,11 +156,6 @@ void ExtractionContainers::PrepareData(ScriptingEnvironment &scripting_environme | |||||||
|     WriteCharData(name_file_name); |     WriteCharData(name_file_name); | ||||||
|     WriteTurnLaneMasks(turn_lane_file_name, turn_lane_offsets, turn_lane_masks); |     WriteTurnLaneMasks(turn_lane_file_name, turn_lane_offsets, turn_lane_masks); | ||||||
| } | } | ||||||
|     catch (const std::exception &e) |  | ||||||
|     { |  | ||||||
|         std::cerr << "Caught Execption:" << e.what() << std::endl; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| void ExtractionContainers::WriteTurnLaneMasks( | void ExtractionContainers::WriteTurnLaneMasks( | ||||||
|     const std::string &file_name, |     const std::string &file_name, | ||||||
|  | |||||||
| @ -73,7 +73,6 @@ namespace extractor | |||||||
|  */ |  */ | ||||||
| int Extractor::run(ScriptingEnvironment &scripting_environment) | int Extractor::run(ScriptingEnvironment &scripting_environment) | ||||||
| { | { | ||||||
|     try |  | ||||||
|     { |     { | ||||||
|         util::LogPolicy::GetInstance().Unmute(); |         util::LogPolicy::GetInstance().Unmute(); | ||||||
|         TIMER_START(extracting); |         TIMER_START(extracting); | ||||||
| @ -202,14 +201,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment) | |||||||
|         util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) |         util::SimpleLogger().Write() << "extraction finished after " << TIMER_SEC(extracting) | ||||||
|                                      << "s"; |                                      << "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
 |         // 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
 |         // 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: " |         util::SimpleLogger().Write() << "To prepare the data for routing, run: " | ||||||
|                                      << "./osrm-contract " << config.output_file_name << std::endl; |                                      << "./osrm-contract " << config.output_file_name << std::endl; | ||||||
|     } |     } | ||||||
|     catch (const std::exception &e) |  | ||||||
|     { |  | ||||||
|         util::SimpleLogger().Write(logWARNING) << e.what(); |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -228,8 +228,3 @@ int main(int argc, char *argv[]) try | |||||||
|     osrm::util::SimpleLogger().Write() << "finished component analysis"; |     osrm::util::SimpleLogger().Write() << "finished component analysis"; | ||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     osrm::util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -162,8 +162,3 @@ catch (const std::bad_alloc &e) | |||||||
|         << "Please provide more memory or consider using a larger swapfile"; |         << "Please provide more memory or consider using a larger swapfile"; | ||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -161,8 +161,3 @@ catch (const std::bad_alloc &e) | |||||||
|         << "Please provide more memory or consider using a larger swapfile"; |         << "Please provide more memory or consider using a larger swapfile"; | ||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ void runStatistics(std::vector<double> &timings_vector, Statistics &stats) | |||||||
| 
 | 
 | ||||||
| boost::filesystem::path test_path; | boost::filesystem::path test_path; | ||||||
| 
 | 
 | ||||||
| int main(int argc, char *argv[]) try | int main(int argc, char *argv[]) | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| #ifdef __FreeBSD__ | #ifdef __FreeBSD__ | ||||||
| @ -312,14 +312,3 @@ int main(int argc, char *argv[]) try | |||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
| #endif | #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; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -371,8 +371,3 @@ catch (const std::bad_alloc &e) | |||||||
|         << "Please provide more memory or consider using a larger swapfile"; |         << "Please provide more memory or consider using a larger swapfile"; | ||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     util::SimpleLogger().Write(logWARNING) << "[exception] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ void springclean() | |||||||
| } | } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int main() try | int main() | ||||||
| { | { | ||||||
|     osrm::util::LogPolicy::GetInstance().Unmute(); |     osrm::util::LogPolicy::GetInstance().Unmute(); | ||||||
|     osrm::util::SimpleLogger().Write() << "Releasing all locks"; |     osrm::util::SimpleLogger().Write() << "Releasing all locks"; | ||||||
| @ -74,8 +74,3 @@ int main() try | |||||||
|     osrm::tools::springclean(); |     osrm::tools::springclean(); | ||||||
|     return EXIT_SUCCESS; |     return EXIT_SUCCESS; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     osrm::util::SimpleLogger().Write(logWARNING) << "[excpetion] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -99,8 +99,3 @@ catch (const std::bad_alloc &e) | |||||||
|            "address space (note: this makes OSRM swap, i.e. slow)"; |            "address space (note: this makes OSRM swap, i.e. slow)"; | ||||||
|     return EXIT_FAILURE; |     return EXIT_FAILURE; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     util::SimpleLogger().Write(logWARNING) << "caught exception: " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <iostream> | #include <iostream> | ||||||
| 
 | 
 | ||||||
| int main() try | int main() | ||||||
| { | { | ||||||
|     osrm::util::LogPolicy::GetInstance().Unmute(); |     osrm::util::LogPolicy::GetInstance().Unmute(); | ||||||
|     osrm::util::SimpleLogger().Write() << "Releasing all locks"; |     osrm::util::SimpleLogger().Write() << "Releasing all locks"; | ||||||
| @ -13,8 +13,3 @@ int main() try | |||||||
|     barrier.update_mutex.unlock(); |     barrier.update_mutex.unlock(); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| catch (const std::exception &e) |  | ||||||
| { |  | ||||||
|     osrm::util::SimpleLogger().Write(logWARNING) << "[excpetion] " << e.what(); |  | ||||||
|     return EXIT_FAILURE; |  | ||||||
| } |  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user