Better handling of DB errors, in case the DB is at least partly readable. I've only ever seen this happen once, btw, on a machine w/ flaky failing memory.

This commit is contained in:
Brian Cox 2016-06-10 11:30:23 -07:00
parent c7b83c88d8
commit 202fd93c9d
1 changed files with 14 additions and 1 deletions

15
src/db/hierdatabase.cpp Normal file → Executable file
View File

@ -39,6 +39,7 @@
#include "core/archive.h"
#include "core/upperbound.h"
#include "core/errorbucket.h"
#include "core/errorbucketimpl.h"
// TODO -- all of these util_ functions should throw an eArchive if an attempt is made to
// write to a null address
@ -288,7 +289,19 @@ void cHierDatabaseIter::LoadArrayAt(const cHierAddr& addr) //throw (eArchive, eH
while( ! curAddr.IsNull() )
{
mEntries.push_back( cHierEntry() );
util_ReadObject( mpDb, &mEntries.back(), curAddr );
//Catch db errors, in case only part of db is broken
try
{
util_ReadObject( mpDb, &mEntries.back(), curAddr );
}
catch( eError& e )
{
e.SetFatality(false);
cErrorReporter::PrintErrorMsg(e);
mEntries.pop_back();
break;
}
curAddr = mEntries.back().mNext;
}