Raise a custom Exception on connection error

Signed-off-by: Lewis Marshall <lewis@lmars.net>