adding an error handler for the tls socket connection