Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] xml tag names and exceptions
From: Ashley Smith (yuumei_at_[hidden])
Date: 2009-05-18 07:32:18


> AMDG
>
> Ashley Smith wrote:
>
>> Hi, I've been using boost for a while now and it's brilliant! :D
>>
>> Anyway, I'm using serialization in my code and was wondering why I was
>> catching an exception where the what() reported "uninitialized
>> exception". Eventually I worked it out (After much debugging) that I was
>> catching the exception like this:
>>
>> } catch( std::exception & e ) {
>> std::cout << e.what() << std::endl;
>>
>> I found out that my xml tags could not have namespace qualifiers in them
>> (I.e. "blah::abc" would not work) and that it would throw a
>> boost::archive::xml_archive_exception. This obviously didn't work with
>> an std::exception and defaulted to an uninitialised exception. So my
>> question is: am I catching the exceptions in the wrong way? Whats the
>> right way? Should I use a more specific boost exception class?
>>
>>
>
> Can you catch xml_archive_exception instead of std::exception?
> It almost sounds like the exception has been sliced.
>
> In Christ,
> Steven Watanabe
>

Thanks for replying.
Thats strange, it catches the boost::archive::xml_archive_exception, but
it is still set as an uninitialized exception. I'm sure this is what is
being thrown though. I think the source of the exception is in
boost/archive/impl/basic_xml_oarchive.ipp

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net