Changes between Version 2 and Version 3 of ProgrammingGuidelines


Ignore:
Timestamp:
07/12/11 14:15:16 (8 years ago)
Author:
welberge
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProgrammingGuidelines

    v2 v3  
    22[PageOutline] 
    33== Exception handling guidelines == 
    4  1. Use checked exceptions for exceptions that the client can take useful actions upon. Use RunTimeException and its subclasses otherwise. 
    5  1. Store information in the exceptions so that the client can use this information in recovering from them (for example: the AudioUnitPlayException contains the failing AudioUnit) 
     4 1. Use checked exceptions for exceptions that the client can take useful actions upon. Use !RunTimeException and its subclasses otherwise. 
     5 1. Store information in the exceptions so that the client can use this information in recovering from them (for example: the !AudioUnitPlayException contains the failing !AudioUnit) 
     6 1. A chain of exceptions can be used to translate a low-level exception into a higher level one. When this technique is used, always include the original exception in the higher level exception (using initCause), so that it stack trace can be used in debugging. 
     7 1. Don't ignore exceptions. Either catch them and act upon them or throw them. If an exception can't happen, but has to be caught anyways, throw an !AssertionError. If the occurrence of an exception doesn't influence the progress of the client (for example, a file not properly closing after reading all information from it), at least log it. 
    68 
    79