Exception messages
I've been spending a lot of time working on legacy code lately and apart from everything else, the thing that sticks out is good exception handling. Doing this has firmed my belief in handling exceptions as close to the source as possible (or alternatively where you have the most context) and wrapping them in RuntimeExceptions (or subclasses of). It also highlights the importance of placing decent messages into exceptions. The usual "Cannot do X" is next to useless. In our bookings engine you have all sorts of good context, booking numbers, flight details, site codes, etc. that allow you to track down problems in code that a stack trace doesn't always allow.
What prompted this post was the above image from TheServerSide.com with a wonderful message.
1 Comments:
This is possibly why having unchecked exceptions (by default) in .NET is a good thing!
BTW, I can highly recommend checking out Splunk as a way to get to grips with what is happening in your log files!
Post a Comment
<< Home