Added error handling for dodgy connections

Signed-off-by: Garage Pythons <garagepythons@gmail.com>