3 ms·
"Expected errors should not throw, raise, or panic. Instead, they should return an error result." Part of the problem is devs often can't tell the difference b
by scuff3d 7mo ago
"Expected errors should not throw, raise, or panic. Instead, they should return an error result."
Part of the problem is devs often can't tell the difference between an error and a negative result. For example, I worked in a code base once that threw errors when a database query came back empty. That's not an error, that's a result! Errors should be _exceptional_ cases, like the connection to the database dropped, or the user provided bad input making the query impossible.
Errors as happy path control flow also drive me nuts.