diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2014-01-06 15:09:26 +0100 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2014-01-06 15:09:26 +0100 |
commit | 7e08e29117546aae66b0b418b2044f77b70b312f (patch) | |
tree | d948534e625e8c630f22cdd72c4a59dcb59000bb /src/main.cpp | |
parent | 37d30ec3cf51aa332ce95ecf52fdd3e8e3d7228b (diff) |
better std::exception logging for block/undo files
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 017a0768d5..05a5b9b857 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -878,11 +878,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; } } @@ -931,7 +931,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); @@ -940,7 +940,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; @@ -959,19 +959,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; } @@ -2852,7 +2852,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); |