3 ms·
if the "red" function isn't successful, than you're mapping that error to what? a RuntimeException? great – you've now escaped the indirection with the original
by dfee 5y ago
if the "red" function isn't successful, than you're mapping that error to what? a RuntimeException? great – you've now escaped the indirection with the original solution – just use RuntimeExceptions.
map it to another checked exception and you now have a "blue" function. and, you also have another layer of abstraction in your errors.
if you can't actually handle the error, skip the circus and just let the exception propagate to a general error boundary (alongside all those RuntimeExceptions you're unaware of).
It's a deep ocean, your defense mechanism of guarding against Checked Exceptions is a small fraction of all exceptions.
To be fair, I did really like the idea of checked functions when I first started using Java. But in practice, it's just too hard to tell what operations should be Checked / Unchecked (sometimes).