Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-03-21 11:24:59


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 exception
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
propogation.

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.

-- 
AlisdairM

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