Throw exception on failure to connect.