Centralized error handling
I went through few threads at Stack-overflow, I am bit confused about the words about centralized error handling.
- One Article in codeproject here, explains handling it in the main method through threads
- In MSDN, they mentioned like "Use try/finally blocks around code that can potentially generate an exception and centralize your catch statements in one location. In this way, the try statement generates the exception, the finally statement closes or deallocates resources, and the catch statement handles the exception from a central location"
Could any body clarify more about centralized error handling and what is the best way to implement it?
The only part of error handling that might be centralized would be the logging of the error.
- only handle those exceptions that your program may be able to apply some control over ( restart for a timeout exception for example)
- finally blocks should be used to release unmanaged resources, note that finally blocks run after either the try block or exception block run