[JENKINS-14575]: handle non expected Exceptions as well example: GitException

The current logic did not support the GitException, so the retry did not work. With this patch, it is going to catch the other exceptions generated from the different SCM plugins so the retry will work with them as well.