if you have an error, connection is undefined.