I have third party libraries being used in my application and I don’t know what exceptions they can throw, obviously from debugging and use I can work out some of them but not all.
So, is there a way to know what Exceptions could be thrown without documentation?
Failing that, I know I can catch (Exception) even though most guidelines recommend against that but if I don’t catch them will they just bubble up through to the top exception handler? Is there any reason why they wouldn’t be able to be handled in this way?
Without documentation from the third-party library, there’s no way of knowing exactly what Exceptions will be thrown.
Any un-caught Exceptions in your code (like you mention) will bubble up to the top handler. I wouldn’t suggest blanket catching all Exceptions though (unless it is a top level logger or something similar). You should really only be handling Exceptions that you can recover from.