Opened 12 years ago

Last modified 10 years ago

#5496 new Feature Requests

Add API for detection of exception

Reported by: anberlin.myplace@… 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 anberlin.myplace@…, 12 years ago

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() );

...
}

comment:2 by Steven Watanabe, 12 years ago

std::uncaught_exception?

in reply to:  2 comment:3 by anberlin.myplace@…, 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.

comment:4 by Emil Dotchevski, 10 years ago

What is the motivating case for this feature?

Note: See TracTickets for help on using tickets.