Catching Errors
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 19 18:05:29 PST 2017
On Thu, 19 Jan 2017 14:29:46 +0000, Jack Stouffer wrote:
> From what I understand, the difference between an Exception and and
> Error is that Errors signal your program has entered into an invalid
> state.
That's the intent, but I don't think that matches reality.
> For example, going past the end of an array and attempting to
> access that memory.
The program is in a well-defined state. In production, I want to catch
and log that problem, move that work item into the dead letter queue, and
move on.
There are other problems that lead to the program being in an
unpredictable, possibly unusable state. This is primarily when the
runtime produces an Error regarding its internal state (as opposed to
parameter validation).
More information about the Digitalmars-d
mailing list