I always implement try...catch(Throwable) (Throwable is really a mistake, and your application should not perform any further operations after it received one of them) at ONE point of my code, when it is very important to know what happened It can be registered. This is usually the main place.
I also have an attempt ... catch (exception) in a runnable class or class that processes, for example, one record, which can be processed independently of the others. In this case, the application must move on even if part of its processing fails - it doesn’t matter if I know which exception will be thrown or not - I will catch the exception, I will write it, I will interrupt this processing record, and I will move on .
The rule of thumb is that you should catch an exception if you are going to do something (stop processing something, start an alternative procedure or go to it if you know what you are doing) if you are not going to do anything, don't catch it.
And don't use the try...catch IDE creator to hide your exception, add exceptions to the method signature instead.
Ravi wallau
source share