Hi Bec, I try to approach these problems pragmatically. I'm unaware of your development environment, deadlines etc. So, pragmatically I say just to do the bare minimum to start with. For me that would be to let the caller of the class handle the exceptions they care about. Once you have some feedback/experience then you can respond to it later on.
Practically, for me that means that the caller would handle the exceptions that they know about and let the application fail hard and fail fast for any unknown exceptions. I haven't needed to create a custom exception yet. I have found that Microsoft have provided me with all the exceptions I need e.g. Application exception. I hope this helps. Regards, Michael O'Dea-Jones -----Original Message----- From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Bec Carter Sent: Wednesday, 9 June 2010 12:00 PM To: ozDotNet Subject: Custom exception? Hi! >From the more experienced programmers here, when is it appropriate to create custom exceptions? I am finding a mix of opinions around. eg. I have a class which generates reports. Part of the process is to create a directory if it does not already exist. If the create directory fails several types of exceptions can be thrown like System.UnauthorizedAccessException, DirectoryNotFoundException and so on. Should the caller of this class care about all of these or should they just worry about catching a ReportGenerationException which tells them exactly what went wrong? Cheers. --Bec--