News for hackers. Stuff that matters.
Re:You’re better off using Exceptions by appleiigs on Monday February 03, 2020 @12:19PM (#22226313)
Then would you be nesting a number of exceptions. Some maybe real 404 exceptions, but some would be zero records found. And I think the zero records found should be handled in the business logic (if statements, switch/case), not in the exceptions.
Re:You’re better off using Exceptions by barrkel on Monday February 03, 2020 @05:25PM (#22229981)
The expectation of a single result should be encoded in the API, not the business logic. It's a very common expectation for e.g. identifiers found on http paths.
Re:You’re better off using Exceptions by joshuamorton on Monday February 03, 2020 @02:06PM (#22227699)
If I expect exactly one result, zero results is exceptional. If I expect zero or more results, zero results should be handled by the business logic.