Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-17 13:49:15


From: "Beman Dawes" <bdawes_at_[hidden]>
> At 11:50 AM 12/17/2002, Peter Dimov wrote:
>
> >std::cerr << translate_text(ex.error_str()) << std::endl;
>
> Um... Rather than fatten the interface to filesystem_exception further,
the
> code->string translation could be provided as a free function. That way
you
> don't have to pay for it if you don't use it.

For filesystem_error considered on its own, a free function would be
perfectly acceptable. It's when we start thinking about The One True Way to
handle errors when the above is needed. That's why I like to (re|ab)use
what() as the "error string" function: you can write

catch(std::exception const & ex)
{
   std::cerr << translate_text(ex.what()) << std::endl;
}

Two other contexts where we may experiment with/explore a common exception
infrastructure are Boost.Threads and lightweight_mutex (used by shared_ptr)
where the pthread-based implementations can reuse an errno-based exception
class if it's available.


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