From: "Martin Brown" <[EMAIL PROTECTED]> > Hi, > > I would second the approach below. If I can get to > the native error code, then I can use FormatMessage() > or strerror() to get to the platform error message, > localised if necessary. I am not so interested in > the name of the function throwing the exception - I > tend to use a logger with a stack-trace built in.
The purpose of the function name is to act as a portable unique identifier that answers the "what failed?" question; the error code answers the "why did it fail?" question. Both parts are needed, in general, to construct an error message. I.e. who() == "std::fopen" path1() == "foo.txt" error() == ENOENT (or "ENOENT") Sample message: "foo.txt": Open error: No such file or directory Depending on the situation, one of the "what"/"why" pieces can be encoded in the exception type (open_error or file_not_found for the above), but it's still useful to have a common mechanism to obtain them from a single catch clause. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost