Throw exception if we can't connect.