aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-01-18 12:16:24 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-01-18 12:25:05 +0100
commit6c19ca1f92c014a9a7155e159fda592733fb1d4c (patch)
tree19e622d8d9f79624b9403d2d3555f93a5b9dec57 /src
parent08ede8ef5edd8bfe6b80d0900bd9bd65b2d45cbf (diff)
parent7e08e29117546aae66b0b418b2044f77b70b312f (diff)
Merge pull request #3490
7e08e29 better std::exception logging for block/undo files (Philip Kaufmann)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp16
-rw-r--r--src/main.h10
2 files changed, 13 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9c6c1ba0c3..3ff1fd3a91 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -883,11 +883,11 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
fseek(file, postx.nTxOffset, SEEK_CUR);
file >> txOut;
} catch (std::exception &e) {
- return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
+ return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what());
}
hashBlock = header.GetHash();
if (txOut.GetHash() != hash)
- return error("%s() : txid mismatch", __PRETTY_FUNCTION__);
+ return error("%s : txid mismatch", __PRETTY_FUNCTION__);
return true;
}
}
@@ -936,7 +936,7 @@ bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos)
// Open history file to append
CAutoFile fileout = CAutoFile(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION);
if (!fileout)
- return error("WriteBlockToDisk() : OpenBlockFile failed");
+ return error("WriteBlockToDisk : OpenBlockFile failed");
// Write index header
unsigned int nSize = fileout.GetSerializeSize(block);
@@ -945,7 +945,7 @@ bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos)
// Write block
long fileOutPos = ftell(fileout);
if (fileOutPos < 0)
- return error("WriteBlockToDisk() : ftell failed");
+ return error("WriteBlockToDisk : ftell failed");
pos.nPos = (unsigned int)fileOutPos;
fileout << block;
@@ -964,19 +964,19 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
// Open history file to read
CAutoFile filein = CAutoFile(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION);
if (!filein)
- return error("ReadBlockFromDisk(CBlock&, CDiskBlockPos&) : OpenBlockFile failed");
+ return error("ReadBlockFromDisk : OpenBlockFile failed");
// Read block
try {
filein >> block;
}
catch (std::exception &e) {
- return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
+ return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what());
}
// Check the header
if (!CheckProofOfWork(block.GetHash(), block.nBits))
- return error("ReadBlockFromDisk(CBlock&, CDiskBlockPos&) : errors in block header");
+ return error("ReadBlockFromDisk : Errors in block header");
return true;
}
@@ -2876,7 +2876,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
break;
}
} catch (std::exception &e) {
- LogPrintf("%s() : Deserialize or I/O error caught during load\n", __PRETTY_FUNCTION__);
+ LogPrintf("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what());
}
}
fclose(fileIn);
diff --git a/src/main.h b/src/main.h
index f3f9acb639..60e733b23a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -336,7 +336,7 @@ public:
// Open history file to append
CAutoFile fileout = CAutoFile(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION);
if (!fileout)
- return error("CBlockUndo::WriteToDisk() : OpenUndoFile failed");
+ return error("CBlockUndo::WriteToDisk : OpenUndoFile failed");
// Write index header
unsigned int nSize = fileout.GetSerializeSize(*this);
@@ -345,7 +345,7 @@ public:
// Write undo data
long fileOutPos = ftell(fileout);
if (fileOutPos < 0)
- return error("CBlockUndo::WriteToDisk() : ftell failed");
+ return error("CBlockUndo::WriteToDisk : ftell failed");
pos.nPos = (unsigned int)fileOutPos;
fileout << *this;
@@ -368,7 +368,7 @@ public:
// Open history file to read
CAutoFile filein = CAutoFile(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION);
if (!filein)
- return error("CBlockUndo::ReadFromDisk() : OpenBlockFile failed");
+ return error("CBlockUndo::ReadFromDisk : OpenBlockFile failed");
// Read block
uint256 hashChecksum;
@@ -377,7 +377,7 @@ public:
filein >> hashChecksum;
}
catch (std::exception &e) {
- return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
+ return error("%s : Deserialize or I/O error - %s", __PRETTY_FUNCTION__, e.what());
}
// Verify checksum
@@ -385,7 +385,7 @@ public:
hasher << hashBlock;
hasher << *this;
if (hashChecksum != hasher.GetHash())
- return error("CBlockUndo::ReadFromDisk() : checksum mismatch");
+ return error("CBlockUndo::ReadFromDisk : Checksum mismatch");
return true;
}