Thursday, 14 August 2008

Error handling

Whilst I, like all of you I am sure, never write code which would need an error handler, I am intrigued on how this is approached across the various deployment I have seen.

Some deployments leave errors in the lap of the gods, and to be honest, the error handler in Pivotal meets a lot of peoples needs. Others rely on logging all errors to an external file, even others create a separate error class in the event viewer to show what is going on.

I just have a feeling that all this error handling adds to the complexity of the situation, and can be the majority of the code.

With the essential try...catch in C# I am coming to the conclusion that it is essential to log as much as possible at the lowest level when an error occurs, as the user never gives us the whole picture, certainly not remembering exactly what they did and copying the error message. A vague 'Pivotal is broken' is the usual phone call I get.

No comments: