Comment by malkia
6 hours ago
The pitfall was if I have to extend it with new exceptions, one had to go and fix all code that was handling it to handle this one too.
Works great in monorepo, but not sure if code is spread out.
6 hours ago
The pitfall was if I have to extend it with new exceptions, one had to go and fix all code that was handling it to handle this one too.
Works great in monorepo, but not sure if code is spread out.
Right, but I think the GP is saying that, with checked exceptions, the 'throws' list is part of that function's API. Changing the 'throws' list is exactly like changing the arguments to or return type of the function.
It's not so much a "pitfall" as it is an intended part of the deal.
It just turns out that many people hated it, so most of the time functions omit the 'throws' list and throw unchecked subclasses of RuntimeException. Which also has its trade offs! (Or "pitfalls", if you want to use the same term.)