From: tho Date: Wed, 4 Nov 2009 16:19:21 +0000 (+0000) Subject: Packets: catch senf::exceptions in Packet.dump() X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=35e271d6c345505475a8cd2654950edd9060e712;hp=f221429e5f88f5543393d546babd958db4b5977c;p=senf.git Packets: catch senf::exceptions in Packet.dump() git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1515 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index 84ba3f1..4dbe329 100644 --- a/senf/Packets/Packet.test.cc +++ b/senf/Packets/Packet.test.cc @@ -240,6 +240,8 @@ BOOST_AUTO_UNIT_TEST(packet) senf::DataPacket::createAfter(packet); BOOST_CHECK_THROW( packet.next().next().next().parseNextAs(), senf::InvalidPacketChainException ); + + SENF_CHECK_NO_THROW( BarPacket::create(senf::noinit).dump(s)); } BOOST_AUTO_UNIT_TEST(concretePacket) diff --git a/senf/Packets/PacketInterpreter.cc b/senf/Packets/PacketInterpreter.cc index fcd6783..9c7e3b2 100644 --- a/senf/Packets/PacketInterpreter.cc +++ b/senf/Packets/PacketInterpreter.cc @@ -74,13 +74,18 @@ prefix_ senf::PacketInterpreterBase::ptr senf::PacketInterpreterBase::append(ptr prefix_ void senf::PacketInterpreterBase::dump(std::ostream & os) { - if (detail::AnnotationIndexerBase::maxAnnotations > 0) { - os << "Annotations:\n"; - impl().dumpAnnotations(os); + try { + if (detail::AnnotationIndexerBase::maxAnnotations > 0) { + os << "Annotations:\n"; + impl().dumpAnnotations(os); + } + v_dump(os); + for (ptr i (next()); i; i = i->next()) + i->v_dump(os); + } + catch (senf::Exception & e) { + os << "[Exception: " << e.message() << "]\n"; } - v_dump(os); - for (ptr i (next()); i; i = i->next()) - i->v_dump(os); } prefix_ void senf::PacketInterpreterBase::finalizeThis()