Added listener for connection error, such that the user can handle it.