Boost logo

Boost :

From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-06-17 14:59:51


On Tuesday, June 17, 2003, at 12:38 AM, Gennadiy Rozental wrote:

> "Daryle Walker" <dwalker07_at_[hidden]> wrote in message
> news:E3553F95-A074-11D7-BD08-0003939C8002_at_snet.net...
>> While writing some other code, I checked out how some of the macros
>> in Boost.Test are implemented. The BOOST_CHECK_THROW and
>> BOOST_CHECK_EXCEPTION macros flag when an intentional exception was
>> missed and when the expected exception type was caught. But what
>> about when an exception of the _wrong_ type is thrown. Shouldn't
>> there be a catch(...) that notes that the wrong type was caught and
>> re-throws the error?
>
> Any operation may throw an unexpected exception. To manage this
> Boost.Test runs test cases under control of the Execution Monitor. Any
> exception thrown from inside a test case gets caught and reported. So
> I believe current semantic of above tools is correct.

(I knew about this possibility, but I was wondering if I should include
its counter in the initial post. I guess I should have.)

1. The unexpected exception may be intercepted before the Execution
Monitor gets it.

2. The general exception catching is OK from most operations. But the
context I described is specifically for exception watching. If you're
watching for exceptions anyway, you should branch on all three
possibilities (missed, caught, caught wrong type) and not hide one of
the possibilities under general handling.

Daryle


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk