Hacker News new | ask | show | jobs
by sabageti 1590 days ago
It isn't? You have a function red that doesn't throws anything you use a function blue that throws checked exceptions you handle the exception and it's all. The red functions doesn't become blue.
1 comments

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).