Java Exception Handling

From MPDLMediaWiki
Revision as of 15:57, 17 September 2008 by MFranke (talk | contribs) (First topics for further reflection)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Problem description

Modules need dependencies of other modules only because of their exception classes

Stacktraces are sometimes swallowed

Sometimes, excessive stacktraces are shown, even without useful information

Logger.error, System.out and e.printStackTrace are mixed up happily

No distinction between exceptions and errors

Conclusion

Distinguish between error and exceptions

Inside a module, always throw errors up as they are

When catching exceptions, log appropriately

Between modules, throw only generic exceptions (e.g. java.lang.Exception, java.lang.RuntimeException)