Every programmer out there learns or is told to write exception handlers in their code, and yes it’s necessary. But many write try{} catch{} just for the sake writing error handlers with no error logging in catch{}. Now this works in opposite direction, instead of working as an error logging tool, the application just suppress errors.
If there is a null object reference error in code, neither even the programmer nor the QA ever knows it, unless the error affects the output of the program. Even if the output of the program is not affected, exceptions are costly and must be handled with care.
Here is a neat trick to catch those errors which are suppressed in empty catch blocks in development environment.
Just set the “Thrown” Common Language Runtime Exceptions check box as shown in the image.
This will make sure that the program breaks on any exception that is thrown.
Breaking the program on each and every exception is sometime nagging. To turn off break on all exception, one can un-check specific exception type. This comes very handy when say one wants to suppress SocketExceptions.
Happy coding.
Friday, January 4, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment