Added error check when retrieving latest commits.