cURL / Mailing Lists / curl-library / Single Mail


Re: How to capture Error message from the Server

From: Colin Ngam <>
Date: Tue, 17 May 2016 19:40:08 +0000

Yes, but if the Server is also sending additional text of the error where can I capture this in the situation of the GET e.g.
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>smC1842A51E22A05000000000000A386410000000100003J7M3CMY9CMULJKG6Q</Key><RequestId>B09B6836031219A8</RequestId><HostId>GIxwOGJB8DMKoIxYcqNkRDL/a1rcrPyg7hmMx+UNNtvUVgaOILdjCMe/ntfo/+bIxWG1D5ws7SU=</HostId></Error>

Currently, what we are doing is comparing the string "<?xml version=“ and saving the buffer just in case of an error overtime the callback is entered.



On 5/17/16, 2:18 PM, "curl-library on behalf of Ray Satiro via curl-library" < on behalf of> wrote:

>On 5/17/2016 2:36 PM, Colin Ngam wrote:
>> In a PUT situation, you can register a callback to capture any
>> messages from the Server. However, in the case of a GET, since the
>> callback is used for receiving data from the server, how do you get
>> error messages from the Server if any? How do you tell the difference
>> when the callback is called that it is data or an extended error
>> message from the Server?
>After curl_easy_perform returns check the HTTP response code [1] in
>addition to its return code. It's also possible to fail on error [2] but
>that closes the connection for each failure (ie another one will be
>opened for the next request to that server), which may not be good
>depending on your circumstances.
>List admin:

The information contained in this transmission may be confidential. Any disclosure, copying, or further distribution of confidential information is not permitted unless such privilege is explicitly granted in writing by Quantum. Quantum reserves the right to have electronic communications, including email and attachments, sent across its networks filtered through anti virus and spam software programs and retain such messages in order to comply with applicable data security and retention requirements. Quantum is not responsible for the proper and complete transmission of the substance of this communication or for any delay in its receipt.

List admin:
Received on 2016-05-17