Program logic bugs vs input/environmental errors
Sean Kelly via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 28 14:16:57 PDT 2014
On Sunday, 28 September 2014 at 20:58:20 UTC, H. S. Teoh via
Digitalmars-d wrote:
>
> That's why I said, an uncaught exception is a BUG. The only
> place where
> user-readable messages can be output is in a catch block where
> you
> actually have the chance to localize the error string. But if
> no catch
> block catches it, then by definition it's a bug, and you might
> as while
> print some useful info with it that your users can send back to
> you,
> rather than unhelpful bug reports of the form "the program
> crashed with
> error message 'internal error'".
Pretty much every system should generate a localized error
message for the user and a detailed log of the problem for the
programmer. Ideally, the user message will indicate how to
provide the detailed information to the developer so the problem
can be fixed.
The one case where uncaught exceptions aren't really a bug is
with programs that aren't being used outside the group that
developed them. In these cases, the default behavior is pretty
much exactly what's desired--a message, file/line info, and a
stack trace. Which is why it's there. The vast bulk of today's
shipping code doesn't run from the command line anyway, so the
default exception handler should be practically irrelevant.
More information about the Digitalmars-d
mailing list