mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
throw inline functions need to keep exception type
As it is useful for functions calling BlockchainDB functions to know whether an exception is expected (attempting to get a block that doesn't exist and counting it missing if not, to save time checking if it does, for example), the inline functions throw{0,1} need to keep the exception type information. Slight comment update due to copy/paste failure.
This commit is contained in:
parent
14555eefd5
commit
429a740562
1 changed files with 5 additions and 3 deletions
|
@ -39,13 +39,15 @@ using epee::string_tools::pod_to_hex;
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
inline void throw0(const std::exception &e)
|
template <typename T>
|
||||||
|
inline void throw0(const T &e)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0(e.what());
|
LOG_PRINT_L0(e.what());
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void throw1(const std::exception &e)
|
template <typename T>
|
||||||
|
inline void throw1(const T &e)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1(e.what());
|
LOG_PRINT_L1(e.what());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -814,7 +816,7 @@ difficulty_type BlockchainLMDB::get_block_cumulative_difficulty(const uint64_t&
|
||||||
auto get_result = mdb_get(txn, m_block_diffs, &key, &result);
|
auto get_result = mdb_get(txn, m_block_diffs, &key, &result);
|
||||||
if (get_result == MDB_NOTFOUND)
|
if (get_result == MDB_NOTFOUND)
|
||||||
{
|
{
|
||||||
throw0(DB_ERROR(std::string("Attempt to get cumulative difficulty from height ").append(boost::lexical_cast<std::string>(height)).append(" failed -- block size not in db").c_str()));
|
throw0(DB_ERROR(std::string("Attempt to get cumulative difficulty from height ").append(boost::lexical_cast<std::string>(height)).append(" failed -- difficulty not in db").c_str()));
|
||||||
}
|
}
|
||||||
else if (get_result)
|
else if (get_result)
|
||||||
throw0(DB_ERROR("Error attempting to retrieve a cumulative difficulty from the db"));
|
throw0(DB_ERROR("Error attempting to retrieve a cumulative difficulty from the db"));
|
||||||
|
|
Loading…
Reference in a new issue