From: "Beman Dawes" <[EMAIL PROTECTED]>
> 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.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to