Exception handling

time to read 2 min | 243 words

Well, my Exception Dialog is completed.

In essence, it's purpose is to allows you to show exceptions to the user in a less intimidating way, while preserving the technical details that you may need.

How to use:

Ayende.Utilities.Error.ExceptionHandler.InitExceptionHandling(false, "your@email.com", "from@his-email.com", "Debug info: WinXP, 128MB, SP1, .NET 1.1.?, etc", "your.smtp-server.com", "Exception details");

(There is some documentation in the file that explains everything, so I won't go over the boring details here.)
The above line of code will handle all unhandled exceptions, it will show a nice dialog to the user, with an option to send you the exception's info.
If for some reason it's impossible to send mail (not connected to network, for example), the user is prompt to save to file, so he can sent it to you by some other means (print & fax it, perhaps?)

As for normal use, just do this:

    //... some code that might throw exception
catch(MyException ex)

Here is how it looks:

Simple dialog && Advance dialog

How do you choose which will be shown?

HandleException() checks in the application configuration file for ShowDetailedExceptionDialog, if it equal to "True" (case sensitive, mind you), then the detailed exception dialog is shown, otherwise, the simple exception dialog is shown.

But there is a trick, press Backspace in the simple dialog, and it will show you the detailed dialog. Neat, isn't it :-S

The bits are here (removed link because it's old and very simple thing, and I need the space in the server)