[boost-users][exception] BOOST_THROW_EXCEPTION returns

Hello all,
A function throws boost::exception as follows:
//....
typedef boost::error_info

On Tue, Mar 24, 2009 at 10:28 AM, Igor R
Hello all,
A function throws boost::exception as follows:
//.... typedef boost::error_info
action_name; BOOST_THROW_EXCEPTION(error() << action_name(name)); return 0; Both BOOST_NO_EXCEPTIONS and BOOST_EXCEPTION_DISABLE are *not* defined. The excpetion is not catched anywhere. However, the thread continues running! If I put breakpoint at "return 0;" it's hit, and I can continue stepping the code. I run the program under MSVC 9.0, in debug mode, and I see "First-chance exception" and "Unhandled exception" notifications issued by the debugger. Isn't it wrong behavior, or I miss something?
Since the debugger tells you that the exception has been thrown, the only way to get the behavior you're observing is if you catch it. Try setting a break point in your exception's destructor. Since you're deriving from boost::exception, you can set the break point at boost::~exception(), in boost/exception/exception.hpp, line 254. It should hit at the closing } in the exception handler. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

Since the debugger tells you that the exception has been thrown, the only way to get the behavior you're observing is if you catch it.
Well, it also tells me that the exception is unhandled(!)... but the thread survives: First-chance exception at 0x7c812aeb (kernel32.dll) in XXX.exe: Microsoft C++ exception: boost::exception_detail::clone_implMyNamespace::error at memory location 0x0529a500.. Unhandled exception at 0x7c812aeb (kernel32.dll) in XXX.exe: Microsoft C++ exception: boost::exception_detail::clone_implMyNamespace::error at memory location 0x0529a500..
Try setting a break point in your exception's destructor. Since you're deriving from boost::exception, you can set the break point at boost::~exception(), in boost/exception/exception.hpp, line 254. It should hit at the closing } in the exception handler.
The ~exception() is called several times (probably the exception object is copied) at the closing "}" of: throw_exception.hpp: template<class E> inline void throw_exception( E const & e ) Then the execution proceeds to the breakpoint at the line after BOOST_THROW_EXCEPTION

On Tue, Mar 24, 2009 at 11:56 AM, Igor R
Then the execution proceeds to the breakpoint at the line after BOOST_THROW_EXCEPTION
Can you put this in a self-contained program? -- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
participants (2)
-
Emil Dotchevski
-
Igor R