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

Excel Interop to open excel with macros disabled

.net excel interop com-interop

Is there a way in C# to switch off macros in excel before loading an excel file. I am loading the excel file using Excel Interop. All I can see is solutions for VB.NET.

Altering search form action not working for custom search module, Drupal 6

drupal search drupal-6

I am altering the value of the form action for the basic search form on a Drupal site. Here is the line I added to our hook_form_alter() implementation in our custom search module:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.