Skip to content
Snippets Groups Projects
Commit 7db0c154 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

tools: catch exceptions

parent 2fc7cc57
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,7 @@ main(int argc, char **argv) ...@@ -62,6 +62,7 @@ main(int argc, char **argv)
#endif #endif
DhtRunner dht; DhtRunner dht;
try {
dht.run(params.port, dht::crypto::generateIdentity("DHT Chat Node"), true, params.network); dht.run(params.port, dht::crypto::generateIdentity("DHT Chat Node"), true, params.network);
if (not params.bootstrap.first.empty()) if (not params.bootstrap.first.empty())
...@@ -137,6 +138,9 @@ main(int argc, char **argv) ...@@ -137,6 +138,9 @@ main(int argc, char **argv)
} }
} }
} }
} catch(const std::exception&e) {
std::cerr << std::endl << e.what() << std::endl;
}
std::cout << std::endl << "Stopping node..." << std::endl; std::cout << std::endl << "Stopping node..." << std::endl;
dht.join(); dht.join();
......
...@@ -85,6 +85,7 @@ main(int argc, char **argv) ...@@ -85,6 +85,7 @@ main(int argc, char **argv)
} }
DhtRunner dht; DhtRunner dht;
try {
dht.run(params.port, {}, true, params.network); dht.run(params.port, {}, true, params.network);
if (not params.bootstrap.first.empty()) if (not params.bootstrap.first.empty())
...@@ -114,6 +115,9 @@ main(int argc, char **argv) ...@@ -114,6 +115,9 @@ main(int argc, char **argv)
std::cout << std::endl << "Scan ended: " << all_nodes->size() << " nodes found." << std::endl; std::cout << std::endl << "Scan ended: " << all_nodes->size() << " nodes found." << std::endl;
for (const auto& n : *all_nodes) for (const auto& n : *all_nodes)
std::cout << "Node " << *n << std::endl; std::cout << "Node " << *n << std::endl;
} catch(const std::exception&e) {
std::cerr << std::endl << e.what() << std::endl;
}
dht.join(); dht.join();
#ifdef WIN32_NATIVE #ifdef WIN32_NATIVE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment