I hate libraries that only throw unchecked exceptions. It seems easier initially, but makes writing correct code more difficult.
Not you have a new problem: How is the code calling the caller supposed to know about that exception? You can't even catch it (even if you know about it!) using normal try-catch because what you have to do is catch the wrapper exception and then check inside that for the exception type you expect via instanceof.
Checked exceptions (at least as implemented in Java) are horrible for the composability of code wrt. error handling.
That is why most libraries eschew checked exceptions these days. Unfortunately, large bits of the standard library in Java forces their hand wrt. re-wrapping stuff like InterruptedException and IOException and the like.
(Not to mention, most of the time you really shouldn't be catching exceptions in very small scopes or at the very highest level in your code. Involving every single layer in between is madness.)
If the complaint is that you then have too many different unchecked exceptions perhaps the error domain has been improperly modeled and you are getting a clue that the system is poorly designed.
You often don't have a choice. Think of generic interfaces -- for example the humble apply method on https://docs.oracle.com/javase/8/docs/api/java/util/function... .
If you have a Function which needs to do some interruptible work you cannot throw InterruptedException -- you must wrap it. This is a fundamental design flaw in Java's exception system and cannot be handwaved away just by saying that Function is badly designed. This problem is pervasive.
The ultimate problem here is one of variance -- throws clauses have the opposite variance rules from method implementations: Subclasses (whether of interfaces or classes) frequently need to more than could be foreseen by the implementor of the interface, so they need to be able to throw "more things", but checked exception clauses explicitly disallow widening the set of thrown exceptions in subclasses (for obvious reasons -- since a FooImpl can be used a runtime where a Foo is expected).
This is a fundamental flaw that was overlooked in the checked exceptions design and there's no fixing it now.
If the type system were more capable, they'd just be equivalent to typed generic error returns, which work fine.
However we're treating them, however, I agree that they are a part of the interface and should be documented (and, where relevant, checked) as such.
Unless you're writing Java where you can force certain exception types to be handled, but people never write that code properly.
100% of checked exception uses must be unchecked.
And this is why exceptions should just not exist. The only ostensible use case is to actually reuse the same few exceptions everywhere so someone can put a generic catch (IOException) that works if you think about your code from a layman perspective, but but also introduces a few vulnerabilities and annoying as hell bugs into the code. But at least it saved 5 lines of code.
When I see some code A -> B -> C where A catches something from C unbeknownst to B, I just assume it's broken. Even in the rare case where I go inspect that library and all 20/20 cases are fine, it is still likely _temporally_ broken code. That is, these kinds of developers will just upgrade dependencies here and there and those dependencies are made by the same kind of developers, and neither communicate with each other about what the interface is, and it just eventually breaks.
If you're doing _anything_ with exceptions other than creating custom exceptions to emulate returning a variant type, your code is broken and results in this:
https://www.lainchan.org/%CE%BB/src/1653782927930-0.jpg
https://www.lainchan.org/%CE%BB/src/1653782927930-1.jpg
https://www.lainchan.org/%CE%BB/src/1653782927930-2.jpg
(this was a huge problem 20 years before Go came out, but Go specifically asked for ridicule here by not having exceptions yet managing to encode the same problem exceptions have, for the sake of solving "problems")
1. Exceptions you expect your consumers to handle.
2. Exceptions you don't expect your consumers to handle.
The first one I would argue you should wrap third party exceptions. There is in nearly every case important context in your code that the thrower of the third party exception will not know and whoever is reading or handling the exception will want to know.
The second one should do whatever the equivalent of crashing is for your use case. Either exiting the program hard or bubbling to some top level handler where a "Something weird and unexpected happened and we can't continue whatever action was going on" alert or log get's recorded and the activity is terminated.
If something is throwing an exception and you don't know it can be throwing an exception it probably belongs in category 2. You may over time transition it to category 1 when you figure out that it is actually handleable.
In my experience though if you aren't disciplined then every exception ends up being lumped into category 2 whether it should be or not. Any language that helps you force the categorization gets bonus points from me.