print error message if connection failed