Re: catch (Exception e)

> One of the most common warnings i ran into playing with MD was:
> /home/max/Projects/beagle_meta/Util/ExifData.cs(696,32): warning
> CS0168:
> 	The variable `e' is declared but never used
> This is usually due to the following bit of code:
> 	try {...}
> 	catch (Exception e) {
> 		Logger.Log.Debug ("Something went wrong...");
> 	}
> IIRC c# also allows:
> 	catch ()
> or
> 	catch (MyOwnException)
> without defining a variable if it is not needed.
> Is there any reason for always putting the e or the ex variables there
> even though they are not used afterwards?

A lot of the code containing such lines come from other projects - so, those 
source files are rarely touched except resyncing them with upstream. You 
would see lots of such examples in Filters and Util. I would say remove the 
variables and commit them to CVS.
But dont make them "catch ()" - we want to know what exceptions are we 
expecting and catch only the ones needed.

- dBera

Debajyoti Bera @
beagle / KDE fan
Mandriva / Inspiron-1100 user

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]