|
Boost Users : |
Subject: Re: [Boost-users] Unable to catch exception using boost::asio
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-07-15 14:42:08
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 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