Re: catch (Exception e)



I'm going to agree that this is probably a good practice to try and
enforce, maybe we should add it to HACKING?

-Kevin Kubasik

On Tue, 2006-10-24 at 21:42 +0200, Max wrote:
> Hi,
> 
> 
> Thanks for the quick replies...
> 
> Am Dienstag, den 24.10.2006, 20:16 +0200 schrieb Daniel Naber:
> > On Tuesday 24 October 2006 15:44, Max wrote:
> > 
> > > Is there any reason for always putting the e or the ex variables there
> > > even though they are not used afterwards?
> > 
> > The better question might be: why isn't it used? Even if you don't know 
> > what to do and just log the exception it should print the exact cause of 
> > the problem.
> 
> Quite often you know why a exception will probably be thrown and that it
> does not indicate a problem. I was not explaining my self clear enough.
> i was referring to some cases in beagle like this one
> (BeagleClient/Indexable.cs, Line 287 following):
> 
> 	try {
> 		File.Delete (contentUri.LocalPath);
> 	} catch (Exception ex)
> 	{ 
> 		// It might be gone already, so catch the exception.
> 	}
> 
> Imho it would be best to catch that exception like this:
> 	} catch (FileNotFoundException)
> 	{ 
> 		// It might be gone already, so catch the exception.
> 	}
> 	
> This would also avoid catching other exceptions, that indicate a
> different problem.
> 
> 
> Max
> 
> 
> _______________________________________________
> Dashboard-hackers mailing list
> Dashboard-hackers gnome org
> http://mail.gnome.org/mailman/listinfo/dashboard-hackers

Attachment: signature.asc
Description: This is a digitally signed message part



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