Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-12-17 11:24:00


At 10:18 AM 12/17/2002, Peter Dimov wrote:

>The main problem is that I don't really know the answer. I can tell you
>what doesn't work, but I don't know yet what works. :-)

How about these member functions (in addition to what()):

    int native_error() const { return m_sys_err; }
     // Note: a value of 0 implies a library (rather than system) error

    error_code error() const { return m_err; }

    const string & function() const;
      // name of the function throwing the exception

    const path & path1() const; // argument 1 to function; may be empty()
    const path & path2() const; // argument 2 to function; may be empty()

Code catching the exception with then have all the information that was
available at the point the exception was thrown.

The practical impact is to add one string and two paths to the
implementation of filesystem_error. I can live with that; filesystem_errors
are a commonplace so worth bending over backward to report fully, and in a
way that can be internationalized however the user desires.

Comments?

--Beman


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