Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-12-17 10:57:31


At 12:42 PM 12/16/2002, Peter Dimov wrote:
>> I think that we also need to consider the problem of translating a
>> filesystem_error to a localized error message.
>
>In particular, consider this example of a what() string:
>
>File system error: move_file(): nonexistent, something_else: The system
>cannot find the file specified.
>
>generated by
>
> boost::filesystem::rename("nonexistent", "something_else");
>
>There is no way to localize it, as it (a) contains non-localizable
dynamic
>path names embedded within the message, and (b) the "The system..." part
>obtained from FormatMessage may already have been localized by the OS.

The only solution I can see is to make individually available each of the
components. The generic and native error codes are already available. Add
functions to retrieve the base message (which identifies the particular
function throwing the exception), and any associated paths.

A complete message would still be available via what(), for those who don't
care to do manipulations.

The exception ends up being a heavier component, but I guess that is
unavoidable to support the functionality you need.

>There is an unreachable return in path::is_complete, BTW. :-)

Fixed. Thanks,

--Beman


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