Program logic bugs vs input/environmental errors
Jeremy Powers via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 29 12:32:10 PDT 2014
On Mon, Sep 29, 2014 at 11:58 AM, Steven Schveighoffer via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
> On 9/29/14 2:43 PM, Jeremy Powers via Digitalmars-d wrote:
>
>> On Mon, Sep 29, 2014 at 8:13 AM, Steven Schveighoffer via Digitalmars-d
>> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
>>
>> My entire point is, it doesn't matter what is expected or what is
>> treated as "correct." what matters is where the input CAME from. To
>> a library function, it has no idea. There is no extra type info
>> saying "this parameter comes from user input."
>>
>>
>> From the method's view, parameters passed in are user input. Full stop.
>>
>
> This is missing the point of an exception. An uncaught exception is an
> error which crashes the program. If you catch the exception, you can handle
> it, but if you don't expect it, then it's a bug. Any uncaught exceptions
> are BY DEFINITION programming errors.
I agree (except the bit about missing the point). The point I wanted to
make was that encapsulation means what is a fatal error to one part of a
program may be easily handled by the containing part. Just because an
exception is thrown somewhere does not mean the program is broken - it is
the failure to handle the exception (explicit or inadvertent) that
indicates an error.
What is being discussed here is removing the stack trace and printout when
> an exception is thrown.
> ....
Sure, but it doesn't happen. Just like people do not check return values
> from syscalls.
>
> The benefit of the exception printing is at least you get a trace of where
> things went wrong when you didn't expect them to. Ignoring a call's return
> value doesn't give any notion something is wrong until much later.
>
> -Steve
>
I absolutely do not want a removal of stack trace information. If an
uncaught exception bubbles up and terminates the program, this is a bug and
I sure as hell want to know as much about it as possible. If having such
information presented to the end user is unacceptable, then wrap and spew
something better.
Ignoring an error return value is like ignoring an exception - bad news,
and indicative of a broken program.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140929/c385d0b3/attachment.html>
More information about the Digitalmars-d
mailing list