Coding Horror

programming and human factors

User-Friendly Exception Handling

I just posted a new article on Code Project, User Friendly Exception Handling. This is a set of classes that deal with unhandled and handled exceptions through a consistent UI, as presented in Alan Cooper's great book About Face: The Essentials of User Interface Design.

animated screenshot of unhandled exception

Anyway, at the time of the unhandled exception, here's what you get for free:

  • Display an automatic, Cooper-Approved(tm) exception interface
  • Capture a screenshot of the user's desktop
  • Build a string containing comprehensive diagnostic information
  • Notify the developers via SMTP e-mail, and attach the screenshot
  • Write an event to the event log
  • Write a plain-text exception log in the application folder
I have used the hell out of this code and it works like gangbusters. There's nothing like an extremely tight loop between developers and exceptions to facilitate quick, responsive fixes to broken code. And since we have it set up to email every team member for every Unhandled Exception-- it's a therapeutic form of punishment, too!

Also, if anyone is interested in those animated GIF screenshots-- I had been looking for a simple tool to do this for literally years-- it's the archaic 1997 version of GifgIfgiF. Extremely old-school, but it still works great and generates very tiny, ultra-compatible animated Gifs. Of course you'll want to turn off all the crazy XP theming and revert to 256-color friendly Win2k style forms before you generate these kinds of Gif animations, too.

Download the VS.NET 2003 solution

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Overflow and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: https://infosec.exchange/@codinghorror