Proper error catching

Errors while connecting to chat socket caused crashes