Why does the following code snippet
private void getEvents() throws VersionNotFoundException{
    gameRepository.findAll().forEach(game->{
        HttpHeaders headers = new HttpHeaders();
        String appVersion = getClass().getPackage().getImplementationVersion();
        if (appVersion==null) {
            throw new VersionNotFoundException();
        }
        headers.set("X-TBA-App-Id","4205:"+this.getClass().getPackage().getImplementationVersion());
        HttpEntity<?> requestEntity = new HttpEntity<>(headers);
        restTemplate.exchange(getEventsForYearString, HttpMethod.GET,requestEntity , Event.class, game.getYear());
    });
}
private class VersionNotFoundException extends Exception {
}
in a class cause the line throw new VersionNotFoundException(); to raise a compiler error that VersionNotFoundException must be caught or declared to be thrown? It very clearly is declared to be thrown. 
 
     
    