3 ms·
>There is nothing inherently irreconcilable about a record not existing This just isn't true. It depends on what the record is, and what state you're in (aka:
by horsawlarway 7y ago
>There is nothing inherently irreconcilable about a record not existing
This just isn't true. It depends on what the record is, and what state you're in (aka: CONTEXT).
incredibly clear example:
1. User logs in
2. User record no longer exists
3. Exception
That's not a recoverable situation, and the client should see that as an unexpected error.
- ketzu 7y ago> There is nothing inherently irreconcilable about a record not existing > This just isn't true. It depends on what the record is, and what state you're in (aka: CONTEXT). These two things mean the same thing. It's in the context - > it is not an inherent property. It's not an inherent property - > it's not always present. Some conclude therefore it shouldn't be an exception by default.
- horsawlarway 7y agoOk, fair - I should have included the very next sentence in the quote as well, since OPs argument seems to be that missing records should NEVER cause exception: >Anyone who expects a database to always have records and that the absence of a record is an "exception" has a very strange way of thinking. But pedantics aside, my point stands. There are absolutely contexts and code paths where a missing record is basically unrecoverable. Why bother returning an error to the local calling context when you know that code doesn't make sense anymore and can't recover? A jump to a new code path is the right call, and exceptions do that (with a lot of nice trace information about why we ended up on that new code path to boot). Doesn't mean a missing record should always result in an exception, but it's certainly not a "very strange way of thinking".