File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,6 @@ bool HasLegacyRecords(CWallet& wallet, DatabaseBatch& batch)
541
541
std::unique_ptr<DatabaseCursor> cursor = batch.GetNewPrefixCursor (prefix);
542
542
if (!cursor) {
543
543
// Could only happen on a closed db, which means there is an error in the code flow.
544
- wallet.WalletLogPrintf (" Error getting database cursor for '%s' records" , type);
545
544
throw std::runtime_error (strprintf (" Error getting database cursor for '%s' records" , type));
546
545
}
547
546
@@ -1194,9 +1193,15 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
1194
1193
1195
1194
// Load decryption keys
1196
1195
result = std::max (LoadDecryptionKeys (pwallet, *m_batch), result);
1197
- } catch (... ) {
1196
+ } catch (std::runtime_error& e ) {
1198
1197
// Exceptions that can be ignored or treated as non-critical are handled by the individual loading functions.
1199
1198
// Any uncaught exceptions will be caught here and treated as critical.
1199
+ // Catch std::runtime_error specifically as many functions throw these and they at least have some message that
1200
+ // we can log
1201
+ pwallet->WalletLogPrintf (" %s\n " , e.what ());
1202
+ result = DBErrors::CORRUPT;
1203
+ } catch (...) {
1204
+ // All other exceptions are still problematic, but we can't log them
1200
1205
result = DBErrors::CORRUPT;
1201
1206
}
1202
1207
You can’t perform that action at this time.
0 commit comments