mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 19:33:28 +01:00
blockchain_utilities: properly exit on error
Replace boolean values and exceptions where appropriate
This commit is contained in:
parent
9292c1e7cd
commit
bc110af0ee
@ -185,7 +185,7 @@ int main(int argc, char* argv[])
|
|||||||
if (!boost::filesystem::is_directory(dir_path))
|
if (!boost::filesystem::is_directory(dir_path))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("dump directory path is a file: " << dir_path);
|
LOG_PRINT_RED_L0("dump directory path is a file: " << dir_path);
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -193,7 +193,7 @@ int main(int argc, char* argv[])
|
|||||||
if (!boost::filesystem::create_directory(dir_path))
|
if (!boost::filesystem::create_directory(dir_path))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Failed to create directory " << dir_path);
|
LOG_PRINT_RED_L0("Failed to create directory " << dir_path);
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ int main(int argc, char* argv[])
|
|||||||
std::ofstream raw_data_file;
|
std::ofstream raw_data_file;
|
||||||
raw_data_file.open(output_file_path.string(), std::ios_base::out | std::ios::trunc);
|
raw_data_file.open(output_file_path.string(), std::ios_base::out | std::ios::trunc);
|
||||||
if (raw_data_file.fail())
|
if (raw_data_file.fail())
|
||||||
return false;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
// If we wanted to use the memory pool, we would set up a fake_core.
|
// If we wanted to use the memory pool, we would set up a fake_core.
|
||||||
@ -245,7 +245,7 @@ int main(int argc, char* argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Invalid db type: " << db_type);
|
LOG_PRINT_L0("Invalid db type: " << db_type);
|
||||||
throw;
|
return 1;
|
||||||
}
|
}
|
||||||
boost::filesystem::path folder(m_config_folder);
|
boost::filesystem::path folder(m_config_folder);
|
||||||
folder /= db->get_db_name();
|
folder /= db->get_db_name();
|
||||||
@ -259,7 +259,7 @@ int main(int argc, char* argv[])
|
|||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Error opening database: " << e.what());
|
LOG_PRINT_L0("Error opening database: " << e.what());
|
||||||
throw;
|
return 1;
|
||||||
}
|
}
|
||||||
r = core_storage->init(db, opt_testnet);
|
r = core_storage->init(db, opt_testnet);
|
||||||
#endif
|
#endif
|
||||||
@ -425,7 +425,7 @@ int main(int argc, char* argv[])
|
|||||||
CHECK_AND_ASSERT_MES(r, false, "Failed to dump blockchain");
|
CHECK_AND_ASSERT_MES(r, false, "Failed to dump blockchain");
|
||||||
|
|
||||||
if (raw_data_file.fail())
|
if (raw_data_file.fail())
|
||||||
return false;
|
return 1;
|
||||||
raw_data_file.flush();
|
raw_data_file.flush();
|
||||||
|
|
||||||
LOG_PRINT_L0("Blockchain dump OK");
|
LOG_PRINT_L0("Blockchain dump OK");
|
||||||
|
@ -151,7 +151,7 @@ int main(int argc, char* argv[])
|
|||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Error opening database: " << e.what());
|
LOG_PRINT_L0("Error opening database: " << e.what());
|
||||||
throw;
|
return 1;
|
||||||
}
|
}
|
||||||
r = core_storage->init(db, opt_testnet);
|
r = core_storage->init(db, opt_testnet);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user