Added connection failure error handling.