Subject: [Boost-bugs] [Boost C++ Libraries] #1807: boost::archive::xml_archive_exception does not store error code and reports wrong message text
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-10 12:11:25
#1807: boost::archive::xml_archive_exception does not store error code and reports
wrong message text
-------------------------------------------------+--------------------------
Reporter: R. Brünner <rbruenner_at_[hidden]> | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.35.0 | Severity: Problem
Keywords: xml_archive_exception what |
-------------------------------------------------+--------------------------
The code in the constructor for boost::archive::xml_archive_exception
(basic_xml_archive.hpp) misses to store the error code value. Thus, a
default constructed archive_exception is created with an error code of
"no_exception".
The what() member function of xml_archive_exception therefore always
reports the error "xml_archive_parsing_error" even if the true error
reason is e. g. "xml_archive_tag_name_error". This happens because the
enumeration constants "no_error" and "xml_archive_parsing_error" happen to
both have the same integer value of 0.
Consequence:[[BR]]
After creating any object of type xml_archive_exception the information
about the actual error is lost.
Suggestion:[[BR]]
1) The error enumerations for archive_exception and xml_archive_exception
should be combined[[BR]]
2) The constructor should call
archive_exception::archive_exception(exception_code)
OR
1) xml_archive_exception should have an exception_code member of its own
where the constructor stores its argument[[BR]]
2) The xml_archive_exception::what() function should first check its own
exception_code value and then hand over to the base class function, if no
match is found.
Merging both exception classes would also be an option, though.
Thank you in advance for your assistance.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1807>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC