
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. Cheers, Geoff

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
"Geoff Leyland" <gley001@ec.auckland.ac.nz> wrote in message news:9EDC4024-5B52-11D8-B48C-000A95DB9BF6@ec.auckland.ac.nz... 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
participants (2)
-
Geoff Leyland
-
Jonathan Turkanis