Tuesday, January 12, 2010

Lazy exception handling...

The typical C# code seen does: try{ } catch(Exception exc){ }  Best practices are to handle each type of exception that could occur separately, tools like Telerik JustBeans can/will soon autogenerate the exception possibilities. This brings me to the second aspect, the failure to use:

 

/// <exception cref="System.Exception"> Thrown when... .</exception> 

see documentation.


What is sad, is that tools like StyleFx do not support checking for this (when it is possible). I often seen magic-phrase strings being returned in code that I review, instead of the exception being allowed to bubble up the stack.

No comments:

Post a Comment