Skip to content

Commit

Permalink
catch DatabaseError when backup PBFT message
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Apr 26, 2019
1 parent 4d7370d commit 00b7e1a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions libconsensus/pbft/PBFTEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,17 @@ void PBFTEngine::backupMsg(std::string const& _key, PBFTMsg const& _msg)
_msg.encode(message_data);
try
{
leveldb::Status s = m_backupDB->insert(_key, toHex(message_data));
if (!s.ok() && !s.IsNotFound())
{
PBFTENGINE_LOG(FATAL) << LOG_DESC("Access pbft backup database Failed, please delete " +
c_backupMsgDirName + " and restart again");
exit(1);
}
m_backupDB->insert(_key, toHex(message_data));
}
catch (std::exception& e)
catch (DatabaseError const& e)
{
PBFTENGINE_LOG(FATAL) << LOG_DESC("store backupMsg to leveldb failed")
<< LOG_KV("EINFO", boost::diagnostic_information(e));
exit(1);
}
catch (std::exception const& e)
{
PBFTENGINE_LOG(WARNING) << LOG_DESC("backupMsg failed")
PBFTENGINE_LOG(WARNING) << LOG_DESC("store backupMsg to leveldb failed")
<< LOG_KV("EINFO", boost::diagnostic_information(e));
}
}
Expand Down

0 comments on commit 00b7e1a

Please sign in to comment.