Boost logo

Boost :

From: Geoff Leyland (gley001_at_[hidden])
Date: 2004-02-09 17:52:21


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


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