[serialization] xml tag names and exceptions

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? Thank-you! - Ash

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
participants (2)
-
Ashley Smith
-
Steven Watanabe