I have a requirement where I need to implement an exception handler where any unhandled exception thrown by the application will need to be presented to the user (i.e a popup), and the user can then choose to submit the error to support, or ignore the error.
There are a few questions about the best practices of something like this. The first thing that comes to mind is catching unhandled exceptions for the entire application appears to be a pretty bad idea. But I'm uncertain on what approach I can take to fulfill this requirement.
Here's an idea I have thought about already:
I can subscribe to the DispatcherUnhandledException
event in the App
class, although I'm uncertain whether this will catch all unhandled exceptions. I can then use this to show a popup window for example. Essentially, this will be like wrapping the whole application in a try ... catch
.
Are there any particular patterns I can follow to achieve this kind of functionality? Also, is wrapping the entire application in a try/catch even a good idea?
Thanks in advance.