Refine Exceptions

last modified: September 24, 2008

Begin by declaring one exception class per logical subsystem to HomogenizeExceptions. As you gather more information about particular categories of exceptions that your callers might want to catch, then add subclasses and throw those exceptions instead. For example, from the standard Java libraries, I would create IOException first and then add subclasses as refinements. -- MartinPool

java.lang.Object
   |
   +--java.lang.Throwable
        |
        +--java.lang.Exception
             |
             +--java.io.IOException

Direct Known Subclasses:

ChangedCharSetException?, CharConversionException?, EOFException, FileNotFoundException?,
InterruptedIOException, MalformedURLException, ObjectStreamException?, ProtocolException?, RemoteException?,
SocketException?, SyncFailedException?, UnknownHostException?, UnknownServiceException?,
UnsupportedEncodingException?, UTFDataFormatException, ZipException? 

It is wonderful!!! How about subclassing the exceptions ??? CategoryException | CategoryJava


Loading...