Alex Rivera | Logout

What does "Only catch exceptions you can handle" really mean?

Asked 2011-01-12T20:46:27.223
13

I'm tasked with writing an Exception Handling Strategy and Guidelines document for a .NET/C# project I'm working on. I'm having a tough go at it. There's plenty of information available for how/when to throw, catch, wrap exceptions, but I'm looking for describing what sorts of things should go on inside the catch block short of wrapping and throwing the exception.

try
{
   DoSomethingNotNice();
}
catch (ExceptionICanHandle ex)
{
   //Looking for examples of what people are doing in catch blocks
   //other than throw or wrapping the exception, and throwing.
}

Thanks in advance

Edit
Report

1 Answer

1

Some examples:

  1. Log the exception and just carry on
  2. Retry the thing that went wrong
  3. Try another method of doing what you were trying to do

It all depends on what went wrong. The point is, just catching and re-throwing is of no use to anyone.

answered 2011-01-12T20:53:34.807

Your Answer