Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 17:40:22 PDT 2014


On 9/27/2014 4:55 PM, H. S. Teoh via Digitalmars-d wrote:
> My take on this, is that uncaught exceptions are a program bug.

Not to me. Custom messages would be better, but the exception message should be 
serviceable.


> Uncaught exceptions (which ideally should only be Errors, not
> Exceptions) are a program bug that ought to be fixed. In the case that
> somehow one managed to elude your catch blocks, the full debug infodump
> (source file, line number, stack trace) is useful for users to hand back
> to you in a bug report, so that you can track down the problem. The user
> should not be expected to understand the infodump from an uncaught
> exception, whereas a message printed from a catch block ought to be
> user-understandable (like "can't open 'myphoto.jpg': file not found",
> not "internal error on line 12345" which makes no sense to a user).

Whoa, Camel! You're again thinking of Exceptions as a debugging tool.



More information about the Digitalmars-d mailing list