Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-02-09 18:14:56


"Geoff Leyland" <gley001_at_[hidden]> wrote in message
news:9EDC4024-5B52-11D8-B48C-000A95DB9BF6_at_ec.auckland.ac.nz...
> Hi,
>
> Excuse me if this is already somewhere in boost - I haven't managed
to
> find it. Does anyone else think that an exception that you can
write
> to like a stream would be useful? So that you could go
>
> throw streamy_exception() << "Couldn't open the file " << file_name;
>
> and then later
>
> catch (streamy_exception &s)
> {
> std::cerr << "Oops! : " << s;
> // or
> std::cerr << "Oops! : " << s.what();
> }
>
> I have code that does the above - it really isn't very tricky. If
> there was interest I could tidy it up a bit.
>
> It'd probably be even better to use the format library to compose
the
> error message - then translations would become much easier.
>

Have you seen

    http://www.boost.org/more/error_handling.html

particularly item 4 ("Format the what() message o demand"), but also 3
and 5?

Jonathan


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