add connect error handling

on error, it will get error below.
undefined method 'include?' for nil (NoMethodError)