refactrored connection exception handling, added check to see if we actually get a connection before proceeding
refactrored connection exception handling, added check to see if we actually get a connection before proceeding

Fixes #964

thaim/ansible,thaim/ansible