raise an exception on connection error