Add connectivity checking and replace uses of RuntimeException with uses of
the new GenerationFailureException.