Packets/80221Bundle: enhanced error message in MIHBaseTLVParser::validateType()
tho [Wed, 3 Aug 2011 14:03:04 +0000 (14:03 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1805 270642c3-0616-0410-b53a-bc976706d245

senf/Packets/80221Bundle/TLVParser.cc

index ddc3340..d677de8 100644 (file)
@@ -51,7 +51,9 @@ prefix_ void senf::MIHBaseTLVParser::validateType(boost::uint8_t expectedType)
     const
 {
     if (! check( 1 + senf::bytes(length_()) + length()) )
-        throw InvalidMIHPacketException("truncated TLV.") << " Type: " << unsigned(type());
+        throw InvalidMIHPacketException("truncated TLV.") << " Type: " << unsigned(type())
+            << ", size:" << 1 + senf::bytes(length_()) + length()
+            << ", available: " << std::distance(i(), data().end());
     if (type() != expectedType)
         throw InvalidMIHPacketException("wrong TLV type. expected ") << unsigned(expectedType) << " got " << unsigned(type());
 }