X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fserialize.h;fp=src%2Fserialize.h;h=ca1205102d174503c5698a37b0a915fae4512c42;hp=349a40bfe88747d6cdd73332622455fc41dba58f;hb=0561bbd1c69263dceb24ffacf850788e6e961a13;hpb=6e0c5e3778b83f128f6f14c311d5728392053581 diff --git a/src/serialize.h b/src/serialize.h index 349a40b..ca12051 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1,5 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers +// Copyright (c) 2012 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SERIALIZE_H @@ -155,8 +156,14 @@ template inline void Unserialize(Stream& s, bool& a, int, int=0 - - +#ifndef THROW_WITH_STACKTRACE +#define THROW_WITH_STACKTRACE(exception) \ +{ \ + LogStackTrace(); \ + throw (exception); \ +} +void LogStackTrace(); +#endif // // Compact size @@ -234,7 +241,7 @@ uint64 ReadCompactSize(Stream& is) nSizeRet = xSize; } if (nSizeRet > (uint64)MAX_SIZE) - throw std::ios_base::failure("ReadCompactSize() : size too large"); + THROW_WITH_STACKTRACE(std::ios_base::failure("ReadCompactSize() : size too large")); return nSizeRet; } @@ -905,7 +912,7 @@ public: { state |= bits; if (state & exceptmask) - throw std::ios_base::failure(psz); + THROW_WITH_STACKTRACE(std::ios_base::failure(psz)); } bool eof() const { return size() == 0; } @@ -1120,7 +1127,7 @@ public: { state |= bits; if (state & exceptmask) - throw std::ios_base::failure(psz); + THROW_WITH_STACKTRACE(std::ios_base::failure(psz)); } bool fail() const { return state & (std::ios::badbit | std::ios::failbit); }