1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 03:30:33 +00:00

Provide more info to the user if something fails

This commit is contained in:
Carles Fernandez 2019-02-28 18:27:30 +01:00
parent b1c6e1d91f
commit 551279b9ae

View File

@ -123,7 +123,7 @@ int main(int argc, char** argv)
boost::system::error_code ec;
if (!boost::filesystem::create_directory(p, ec))
{
std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
google::ShutDownCommandLineFlags();
return 1;
}
@ -144,8 +144,9 @@ int main(int argc, char** argv)
}
catch (const boost::thread_resource_error& e)
{
std::cout << "Failed to create boost thread." << std::endl;
std::cerr << "Failed to create boost thread." << std::endl;
google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR program ended." << std::endl;
return 1;
}
catch (const boost::exception& e)
@ -153,12 +154,14 @@ int main(int argc, char** argv)
if (GOOGLE_STRIP_LOG == 0)
{
LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e);
std::cerr << boost::diagnostic_information(e) << std::endl;
}
else
{
std::cerr << "Boost exception: " << boost::diagnostic_information(e) << std::endl;
}
google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR program ended." << std::endl;
return 1;
}
catch (const std::exception& ex)
@ -166,12 +169,14 @@ int main(int argc, char** argv)
if (GOOGLE_STRIP_LOG == 0)
{
LOG(WARNING) << "C++ Standard Library exception: " << ex.what();
std::cerr << ex.what() << std::endl;
}
else
{
std::cerr << "C++ Standard Library exception: " << ex.what() << std::endl;
}
google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR program ended." << std::endl;
return 1;
}
catch (...)
@ -179,12 +184,14 @@ int main(int argc, char** argv)
if (GOOGLE_STRIP_LOG == 0)
{
LOG(WARNING) << "Unexpected catch. This should not happen.";
std::cerr << "Unexpected error." << std::endl;
}
else
{
std::cerr << "Unexpected catch. This should not happen." << std::endl;
}
google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR program ended." << std::endl;
return 1;
}