daemon: print exception errors when failing to parse config file

When an exception happens while reading the config file, we need
to print the error, as the logging system isn't initialized yet,
so the generic catch will not print anything.
This commit is contained in:
moneromooo-monero 2016-06-30 22:15:40 +01:00
parent de91bb75a1
commit 459ec6040e
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 10 additions and 1 deletions

View File

@ -179,9 +179,18 @@ int main(int argc, char const * argv[])
boost::system::error_code ec; boost::system::error_code ec;
if (bf::exists(config_path, ec)) if (bf::exists(config_path, ec))
{
try
{ {
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm); po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
} }
catch (const std::exception &e)
{
// log system isn't initialized yet
std::cerr << "Error parsing config file: " << e.what() << std::endl;
throw;
}
}
po::notify(vm); po::notify(vm);
// If there are positional options, we're running a daemon command // If there are positional options, we're running a daemon command