Opened 12 years ago
Last modified 10 years ago
#5496 new Feature Requests
Add API for detection of exception
| Reported by: | Owned by: | Emil Dotchevski | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | exception |
| Version: | Boost 1.45.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
Purpose: detect if it's possible to call boost::current_exception() when writing generic code.
Solution: add BOOST_CATCH_EXCEPTION() macro or boost::catch_exception() function and boost::has_current_exception() function.
Change History (4)
comment:1 by , 12 years ago
comment:3 by , 12 years ago
Replying to steven_watanabe:
std::uncaught_exception?
It's already catched exception, because we can use boost::current_exception() only in catch block.
Note:
See TracTickets
for help on using tickets.

or add something like
struct __type__ { __type__() { set_current_exception( true ); } ~__type__() { set_current_exception( false ); } }; #define BOOST_REGISTER_EXCEPTION __type__ __a__; try{ ... } catch( ... ) { assert( !has_current_exception() ); BOOST_REGISTER_EXCEPTION(); assert( has_current_exception() ); ... }