Rearrange the error handling a bit in send_request(). The old code