Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] xml tag names and exceptions
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-17 18:43:16


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


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