updated: better error communication error handling for sendRequest and sendCurlRequest