|
Boost : |
From: David Tonge (david.tonge_at_[hidden])
Date: 2004-03-09 09:38:49
I know that recently some changes have been made to the serialization
library to make it raise exceptions on error rather than fail
assertions. In particular, at line #300 of
boost/serialization/oserializer.hpp an unregistered_class exception is
now thrown when the type information system hasn't heard of the class
which is to be serialized.
I think we could go further to aid debugging if the archive_exception
class had another data member which could be used to store the name of
the class which couldn't be written. We'd have something like this
instead...
boost::throw_exception(
boost::archive::archive_exception(
boost::archive::archive_exception::unregistered_class,
typeid(*(&t)).name() // THIS IS THE NEW BIT
)
);
When catching the exception what() would be able to return "unregistered
class: my_derived_class" rather than just "unregistered class". When
you've got a few dozen different classes to serialize through pointers
to base classes it would make it a lot easier to find out which one you
haven't registered properly.
Of course, this does assume that RTTI is available on all our platforms.
Is that an assumption we can make? If not, could we revert to the
current behaviour on platforms which don't have it?
Do the other users of the serialization library have a strong point of
view on this?
DT
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk