1)
1 - Use only exceptions that you can really do something, and 2 - You canβt do anything about the vast majority of exceptions.
a) I suppose the "By not handling an exception"text suggests that we should allow the bubble to be thrown up the stack, where does the runtime interrupt our application ?!
b) But why let runtime terminate the exception, preferring to catch the exception, registering it and then informing the user about the error? The only difference between the two is that in the latter case, the application is not interrupted
For example, if the database is omitted, why is the entire program error (due to the lack of exception handling), if we can catch the exception instead, write it down and notify the user about the error, and this way we can save the program up and running
2) If you know that the exception potentially caused by some block of code is not handled, should this code be included inside the block try-finallyor is it better to leave it outside any blocks try-finally?
thank
source
share