I would say it is a very debatable question among many programmers who have different experiences and tend to have different opinions.My answer might be little lengthy but I feel I cannot answer it short!!!
I believe in the following based on my experience:
- Know the business requirement. If it is a critical application, yes you are very true we should not allow the application to continue and just allow it to crash by showing the user some appropriate message.
- If it is not a very critical application, and you want the user to continue using the application by doing some other task, it makes sense to allow the application to recover gracefully.
To add to the above 2 points I would also like to say , you cannot recover any application if an unhandled application occurs in any thread which you have created. Only exceptions on the main GUI thread can be recovered.
The whole point of adding such code is to make sure debugging and error reporting becomes simpler and easy. For example, say you have a very big application and an unexpected exception occurs somewhere in your code. Now if you have such handlers like you mentioned, you can centralize the whole thing and log the stack trace, messages, etc. And once you have the entire log, its a matter of time to solve the issue and know its source.
I hope it helps!!