
Marshall Clow wrote:
At 10:32 PM +1000 8/23/06, Martin Slater wrote: I wrote:
[ Note that this is not a rejection of Unicode, but rather a separation of the error being detected and thrown and the creation of an error message ]
Absolutely agree with this but one use case for unicode is attaching the possibly unicode filename of a failing file operation.
Yes, that's a good case. But, you've already got some object/data structure that describes the file, right? [ A path, or something ]
Attach _that_ to the exception, and Bob's your uncle.
I'm not sure if uncle Bob realizes that attaching the file object to the exception would require that the file object is copyable, and usually they aren't (unless refcounted), and that this would keep the file open until the exception is processed (which is not desirable). Check out http://www.revergestudios.com/boost-exception/boost-exception.htm#example to see how file errors can be handled with the exception lib.
Personally, I think that the ".what ()" field in the exception is an anachronism. No one is going to show that string to end users.
Like I said in my original post, what() is just for debugging/logging purposes. --Emil