2 ms·
The problem is that virtually all languages abuse exceptions and use them for very much expected control flow and business logic. But exceptions should be just
by bedobi 3y ago
The problem is that virtually all languages abuse exceptions and use them for very much expected control flow and business logic. But exceptions should be just that, exceptional. Eg when you make a db call, the db not responding is not exceptional. Nor is not finding the user you're looking for. Those are 100% within the range of expectable outcomes for a db call.
fun findUser(userId: String) : Either<Error, User>
is MUCH simpler and more powerful than
fun findUser(userId: String) //haha, I can actually throw exceptions that aren't in this signature, or return null (wat)
- deleted 3y ago[deleted]