add connect error handling

on error, it will get error below.
undefined method 'include?' for nil (NoMethodError)
use empty? method
Merge pull request #1 from y-ken/master

improbe connection error handling