You can just catch ElasticHttpNotFoundError here and save yourself the "if" and the re-raise.