Adding better error catching/reporting

Better error reporting when failing to connect.