Centralized error handling

I went through few threads at Stack-overflow, I am bit confused about the words about centralized error handling.

  1. One Article in codeproject here, explains handling it in the main method through threads
  2. 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?

Answers


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

Need Your Help

how to restructure Xmls with Linq XDocument?

xml linq linq-to-xml

I need to restructure loads of xmls. the prefer way of doing is Linq with XDocument .. but I am welcome to any suggesting you may have. Thanks a lot.

Hibernate, jpa and mysql

mysql sql hibernate jpa spring-data

I'm having a small problem with my insert statements in Spring-data/jpa/hibernate/mysql/junit application. I created a small unit test to see if i can do a simple INSERT statement.