DIP33: A standard exception hierarchy

Lars T. Kyllingstad public at kyllingen.net
Wed Apr 3 00:12:56 PDT 2013


On Wednesday, 3 April 2013 at 07:01:09 UTC, Jacob Carlborg wrote:
> On 2013-04-02 22:15, Lars T. Kyllingstad wrote:
>
>> This illustrates my point nicely!  What does the shell do in 
>> this case?
>> It treats both errors the same:  It prints an error message 
>> and returns
>> to the command line.  It does not magically try to guess the 
>> filename,
>> find a way to get you permission, etc.
>
> No, but you do know the difference. It doesn't just say "can't 
> open file <filename>". It will say either, "file <filename> 
> doesn't exist" or "don't have permission to access <filename>". 
> It's a huge difference. I know _what_ went wrong with that 
> file, not just that _something_ when wrong.

Which is exactly what you'd use FilesystemException.kind and/or 
FilesystemException.msg for.

I never said there shouldn't be a way to distinguish between file 
errors, I just said that in most cases, an entirely new exception 
class is overkill.

Lars


More information about the Digitalmars-d mailing list