This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
I was very excited to see your article about exceptions on the JavaWorld site. I have been putting together a coding standard. As with most other I have come across on my web searches, mine is primarily based on JavaSoft's standards. No where have I seen a good standard dealing with exceptions. The problem I see is that on large projects most exceptions that developers define are fairly simple with two constructors, one that takes no args and on that takes a String. Say I have a project has two packages that a totally seperate from each other but both do some sort of parsing. I think most developers would tend to unknowingly define a ParseException in both packages which leads to confusion and does not promote code reuse. I was thinking that it might be a good idea to create an exception package where all exceptions are defined. Then when a developer needs to define a new exception he first looks in this package to see if there is anything he can use and then if not defines one there. The downfall of this approach is that instead of just being able to deliver one package if you also have to deliver this backage package with several exceptions that your package doesn't need. What are your thoughts? Have you seen any good standards?