[Issue 13543] std.file.FileException has useless __FILE__ and __LINE__ arguments tacked on

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 27 15:32:50 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13543

--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to bearophile_hugs from comment #3)
> (In reply to Walter Bright from comment #2)
> > Once again, Exceptions are NOT for debugging user code.
> 
> I don't agree. If I open a file, and the opening fails, I'd like the
> exception to tell me what damned line of my code has tried to open that
> file. Exceptions are useful to debug user code.

This is a serious misuse of Exceptions.

What do your customers think when your apps are showing them file/line pointing
to your internal source code when a file doesn't exist?

I've never even heard of an app that would assault users with such "error"
messages, except for D apps.


The construct to debug code is "assert", not "throw".

Cue my usual rant about confusion between what is a programming logic error and
what is an input/environmental error, and the conflation of the methods for
dealing with them.

--


More information about the Digitalmars-d-bugs mailing list