mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
make all catch() arguments const
- I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase
This commit is contained in:
24
src/main.cpp
24
src/main.cpp
@@ -1091,7 +1091,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
|
||||
file >> header;
|
||||
fseek(file.Get(), postx.nTxOffset, SEEK_CUR);
|
||||
file >> txOut;
|
||||
} catch (std::exception &e) {
|
||||
} catch (const std::exception& e) {
|
||||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
hashBlock = header.GetHash();
|
||||
@@ -1174,7 +1174,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
|
||||
try {
|
||||
filein >> block;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
catch (const std::exception& e) {
|
||||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
|
||||
@@ -2598,7 +2598,7 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
|
||||
return state.Abort("Failed to write block");
|
||||
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
|
||||
return error("AcceptBlock() : ReceivedBlockTransactions failed");
|
||||
} catch(std::runtime_error &e) {
|
||||
} catch (const std::runtime_error& e) {
|
||||
return state.Abort(std::string("System error: ") + e.what());
|
||||
}
|
||||
|
||||
@@ -2990,7 +2990,7 @@ bool InitBlockIndex() {
|
||||
return error("LoadBlockIndex() : genesis block cannot be activated");
|
||||
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
|
||||
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
|
||||
} catch(std::runtime_error &e) {
|
||||
} catch (const std::runtime_error& e) {
|
||||
return error("LoadBlockIndex() : failed to initialize block database: %s", e.what());
|
||||
}
|
||||
}
|
||||
@@ -3030,7 +3030,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
|
||||
blkdat >> nSize;
|
||||
if (nSize < 80 || nSize > MAX_BLOCK_SIZE)
|
||||
continue;
|
||||
} catch (const std::exception &) {
|
||||
} catch (const std::exception&) {
|
||||
// no valid block header found; don't complain
|
||||
break;
|
||||
}
|
||||
@@ -3090,11 +3090,11 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
|
||||
mapBlocksUnknownParent.erase(it);
|
||||
}
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
} catch (const std::exception& e) {
|
||||
LogPrintf("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
}
|
||||
} catch(std::runtime_error &e) {
|
||||
} catch (const std::runtime_error& e) {
|
||||
AbortNode(std::string("System error: ") + e.what());
|
||||
}
|
||||
if (nLoaded > 0)
|
||||
@@ -4088,7 +4088,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
ss << ": hash " << hash.ToString();
|
||||
}
|
||||
LogPrint("net", "Reject %s\n", SanitizeString(ss.str()));
|
||||
} catch (std::ios_base::failure& e) {
|
||||
} catch (const std::ios_base::failure&) {
|
||||
// Avoid feedback loops by preventing reject messages from triggering a new reject message.
|
||||
LogPrint("net", "Unparseable reject message received\n");
|
||||
}
|
||||
@@ -4192,7 +4192,7 @@ bool ProcessMessages(CNode* pfrom)
|
||||
fRet = ProcessMessage(pfrom, strCommand, vRecv, msg.nTime);
|
||||
boost::this_thread::interruption_point();
|
||||
}
|
||||
catch (std::ios_base::failure& e)
|
||||
catch (const std::ios_base::failure& e)
|
||||
{
|
||||
pfrom->PushMessage("reject", strCommand, REJECT_MALFORMED, string("error parsing message"));
|
||||
if (strstr(e.what(), "end of data"))
|
||||
@@ -4210,10 +4210,10 @@ bool ProcessMessages(CNode* pfrom)
|
||||
PrintExceptionContinue(&e, "ProcessMessages()");
|
||||
}
|
||||
}
|
||||
catch (boost::thread_interrupted) {
|
||||
catch (const boost::thread_interrupted&) {
|
||||
throw;
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
catch (const std::exception& e) {
|
||||
PrintExceptionContinue(&e, "ProcessMessages()");
|
||||
} catch (...) {
|
||||
PrintExceptionContinue(NULL, "ProcessMessages()");
|
||||
@@ -4507,7 +4507,7 @@ bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock
|
||||
filein >> *this;
|
||||
filein >> hashChecksum;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
catch (const std::exception& e) {
|
||||
return error("%s : Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user