[serialization][1.33.0?] xml_archive_exception

Robert, In using xml_archive_exception, I find that I need to #include <boost/archive/basic_xml_archive.hpp>. This required searching through the boost directory since the documentation does not mention this requirement. The only mention in the docs is to #include <boost/archive/archive_exception.hpp>, which is insufficient. I would have expected that xml_archive_exception is part of the interface for an xml_(i|o)archive and would be included when #include-ing <boost/archive/xml_(i|o)archive.hpp>. Alternatively, perhaps this class should be placed in <boost/archive/xml_archive_exception.hpp> and documented as such, to be consistent with <boost/archive/archive_exception.hpp>. Additionally, I find the overlap of exception_code misleading when debugging. I caught an archive_exception& and and code returns 0 - 'no_exception'( within the context of an archive_exception ). At this point what() returns null also. Of course, catching an xml_archive_exception helps because what() returns a reasonable description. I run into the above, when loading a file, but that file was generated by a legacy product(not xml or an archive). I had (erroneously)expected that xml_archive would throw an xml_archive_exception equivalent to exception_code==invalid_signature. It would be nice to have a some better granularity on archive_parsing_error, that would tell me that the input does not start with an xml header, or it's xml but not an xml_archive, or it passed those two, and some other error occurs. Thanks, Jeff Flinn

OK, it looks like this is a little out of whack and needs some work. Robert Ramey Jeff Flinn wrote:
Robert,
In using xml_archive_exception, I find that I need to #include <boost/archive/basic_xml_archive.hpp>. This required searching through the boost directory since the documentation does not mention this requirement. The only mention in the docs is to #include <boost/archive/archive_exception.hpp>, which is insufficient. I would have expected that xml_archive_exception is part of the interface for an xml_(i|o)archive and would be included when #include-ing <boost/archive/xml_(i|o)archive.hpp>. Alternatively, perhaps this class should be placed in <boost/archive/xml_archive_exception.hpp> and documented as such, to be consistent with <boost/archive/archive_exception.hpp>. Additionally, I find the overlap of exception_code misleading when debugging. I caught an archive_exception& and and code returns 0 - 'no_exception'( within the context of an archive_exception ). At this point what() returns null also. Of course, catching an xml_archive_exception helps because what() returns a reasonable description. I run into the above, when loading a file, but that file was generated by a legacy product(not xml or an archive). I had (erroneously)expected that xml_archive would throw an xml_archive_exception equivalent to exception_code==invalid_signature. It would be nice to have a some better granularity on archive_parsing_error, that would tell me that the input does not start with an xml header, or it's xml but not an xml_archive, or it passed those two, and some other error occurs. Thanks,
Jeff Flinn
participants (2)
-
Jeff Flinn
-
Robert Ramey