views:

295

answers:

7

Can someone point me to a list of open source projects dedicated to exceptions handling ? Or to the best tool among them ?

Update: I would like to use it with a n tier winform application. I would like to catch once and for all the 3 or 4 kind of exceptions that occur in my data access stack. Then pass them to the gui stack and show them to the user in a message box or something.

+4  A: 

There's ELMAH which is for error logging in web apps. It may or may not be useful to you - you haven't specified anything about what you want it to do, or whether you need it for a web app, WinForms, WPF etc.

Jon Skeet
+3  A: 

You could look at Exceptioneer - although it is not open source, it is free.

Colin Mackay
This one is very much ASP.NET orientated
Khash
Out of the box it does hook in to ASP.NET seamlessly for times when an unhandled exception remains uncaught. However, I have got it working in other application types too.
Colin Mackay
A: 

I would like to use it with a n tier winform application. I would like to catch once and for all the 3 or 4 kind of exceptions that occur in my data access stack. Then pass them to the gui stack and show them to the user in a message box or something.

Please use comments for discussion on answer.
Mahin
I've edited this comment into your question. You can go ahead and delete this answer. Generally, as the asker you want to put your comments about your own question into the question itself.
MusiGenesis
+3  A: 

You can use Application_ThreadException event to handle all exceptions globally. You can find more about it here

[STAThread] static void Main() {
  Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
  Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e) {
  throw new Exception("Whoops");
}

private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
  MessageBox.Show(e.Exception.Message);
}

To show user friendly messages on exception you can check this codeproject article.

You can use Exception Handling Application Block from Microsoft also.The Introduction at MSDN says as below :

The Enterprise Library Exception Handling Application Block lets developers and policy makers create a consistent strategy for processing exceptions that occur in all architectural layers of an enterprise application. It does this in the following ways:

  • It supports exception handling in all architectural layers of an application and is not limited to service interface boundaries.
  • It allows exception handling policies to be defined and maintained at the administrative level so that policy makers, who might be system administrators as well as developers, can define how to handle exceptions. They can maintain and modify the rules that govern exception handling without changing the application block code.
  • It provides commonly used exception handling functions, such as the ability to log exception information, the ability to hide sensitive information by replacing the original exception with another exception, and the ability to maintain contextual information for an exception by wrapping the original exception inside of another exception. These functions are encapsulated in .NET classes named exception handlers.
  • It can combine exception handlers to produce the desired response to an exception, such as logging exception information followed by replacing the original exception with another.
  • It lets developers create their own exception handlers.
  • It invokes exception handlers in a consistent manner. This means that the handlers can be used in multiple places within and across applications.
Mahin
+1  A: 

This is the best I've seen/used. I modified it to fit into an application I support and the results have been great.

I've freaked out many a developer, telling them which line of code has an issue.

Jeff Atwood's exception handler

Brad Bruce
A: 

Is there any aop kind possible for this ?

alfredo dobrekk
Alfredo, this is not a discussion forum. If you have a separate question, ask a new question. If you are modifying your current question, use the edit button to change it.
John Saunders
A: 

I've recently started to use NLog which is an excellent way of logging exceptions and the general running of your application. You can produce some really readable log files/emails/etc. that way.

Colin Mackay