4b23d2dc58
This commit adjusts the error handling to close the socket before calling fail_with and adds specific exceptions to catch