From: Greg Colvin (gregory.colvin_at_[hidden])
Date: 2003-03-21 12:06:45
The idea of the why() member was to preserve context when one exception
gets caught and a different one gets thrown, so you could walk back the
chain of why()'s asking what() and where(). I bring it up just as a
design that might be worth resurrecting if it meets your needs.
On Friday, Mar 21, 2003, at 09:24 America/Denver, Alisdair Meredith
> Greg Colvin wrote:
>> std::exception used to have a why() member that returned the list of
>> exceptions leading to the one caught. Is that part of what you want?
> Not exactly. I'm not too bothered about the history of the exceptions,
> I'm simply concerned with formatting useful error messages for users.
> In order to describe an error usefully/accurately you need as much
> context as possible, so such messages are most usefully
> described/formatted as the exception propogates. If you defer all
> message-formatting until some outer catch block you need to also leak
> sufficient implementation detail and knowledge to form that message.
> In the ideal library, such context information is only accumulated
> during exception propogation, and would not interfere with the
> handling system at all (no catch blocks, some sort of
> RAII/ScopeGuard-like object) To that extent, all that is really needed
> is a known stringstream per thread of execution, and some way to defer
> diagnostic generation unless an exiting the block due to exception
> To an extent, rather than missing why() I am looking for a replacement
> for what() as well!! Among other things I hear that can cause problems
> for localising error messages (something else this scheme should
> address) although I am lucky enough not to have to deal with such
> problems myself.
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk