cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Cassandra Wiki] Update of "CodeStyle" by JonathanEllis
Date Fri, 09 Apr 2010 14:48:33 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.

The "CodeStyle" page has been changed by JonathanEllis.


  == Exception handling ==
   * Never ever write `catch (...) {}` or `catch (...) { logger.error() }` merely to satisfy
Java's compile-time exception checking.  Always propagate the exception up or throw RuntimeException
(or, if it "can't happen," AssertionError).  This makes the exceptions visible to automated
+  * Avoid propagating up checked exceptions that no caller handles.  Rethrow as RuntimeException
(or IOError, if that is more applicable)
   * Similarly, `logger.warn()` is often a cop-out: is this an error or not?  If it is don't
hide it behind a warn; if it isn't, no need for the warning.
   * If you genuinely know an exception indicates an expected condition, it's okay to ignore
it BUT this must be explicitly explained in a comment.

View raw message