You do not need to check, catch, and discard exceptions if you have any particular reason for catching them in the first place. Otherwise, they will automatically receive bubbles from the lower level functions, which pass them to the highest level in your code. Essentially, you can think of them as “instilling,” even though this is not technically what is happening.
In fact, most of the time when you see a try / catch , it is incorrect. You should not catch exceptions if you cannot handle them. It is completely pointless (and actually considered bad practice) to catch exceptions, just to repair them. Do not complete all your code in try blocks.
Please note that by “processing them” I mean that your code in the catch will take some specific action based on the specific exception that was thrown, which tries to fix the exceptional condition.
For example, for FileNotFoundException you can tell the user that the file cannot be found, and ask them to select another.
See my answer here for more details and a detailed discussion of "best practices for handling exceptions."
source share