A RuntimeException is a programming error

Saturday, 5 June 2004

No function should ever throw a RuntimeException by design, unless it has documented requirements for its arguments or object state that are not fulfilled. Essentially, it must always be possible for the caller of a function to do enough checking so that it can be sure no RuntimeException will be thrown.

This is necessary because RuntimeExceptions indicate programming errors. They don’t convey much information to the caller, so it’s never useful to catch them.


Leave a comment