|
Boost Users : |
Subject: Re: [Boost-users] Unable to catch exception using boost::asio
From: Alex Black (alex_at_[hidden])
Date: 2009-07-15 14:50:22
Thanks for the suggestion, I was not aware of boost::current_exception_diagnostic_information(), looks useful!
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> Emil Dotchevski
> Sent: Wednesday, July 15, 2009 2:42 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] Unable to catch exception using boost::asio
>
> On Wed, Jul 15, 2009 at 11:31 AM, Alex Black<alex_at_[hidden]> wrote:
> > Thanks, that fixed it!
> >
> > My destructor now looks like this:
> >
> > try
> > {
> > m_pProtoBufStream.reset();
> > }
> > catch ( std::exception& e )
> > {
> > cout << endl << "Unexpected exception in
> > ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor: " <<
> e.what() << endl;
> > }
> > catch ( ... )
> > {
> > cout << endl << "Unexpected exception in
> > ProtoBufStreamAdaptor::~ProtoBufStreamAdaptor" << endl;
> > }
> >
> > And it does indeed catch an exception. Now my process doesn't die.
>
> I'd replace this with:
>
> try
> {
> m_pProtoBufStream.reset();
> }
> catch ( ... )
> {
> cout << endl << "Unexpected exception caught in " <<
> BOOST_CURRENT_FUNCTION << endl <<
> boost::current_exception_diagnostic_information();
> }
>
> (you'd need to #include <boost/exception/diagnostic_information.hpp>)
>
> Emil Dotchevski
> Reverge Studios, Inc.
> http://www.revergestudios.com/reblog/index.php?n=ReCode
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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