[Fwd: Returned mail: User unknown]

Hi,
  I am not sure if this is the forum for libwww newbies so please
ignore this if it is.

I am trying to use libwww to do a simple retrieval of a file via
either http or ftp. This is in essence a configuration file for a
certain part of the network app I am developing. The address of
the config file is given by the user. I can use libwww to verify
that the address is well formed within the restraints I impose.
However, I want to be able to use the error handling part of
HTRequest to return an intelligent message when the file cannot
be retrieved for some reason. I cannot figure out how this is
done. Here is a representative code sample of what I have at the
moment:

{
	HTProfile_newNoCacheClient ("GetRSS", "1.0");

	/*
	 * Setup the request.
	 */
	HTRequest* request = HTRequest_new();
	HTList* errors = HTList_new();
	HTRequest_setError(request, errors);

	boolean pre_emptive = HTRequest_preemptive(request);
	HTRequest_setPreemptive(request,True);

	HTRequest_setOutputFormat(request, WWW_SOURCE);

	HTChunk* chunk = HTLoadToChunk(_sourceURL, request);

	if (!HTList_isEmpty(errors))
	{
--->		printf("We have errors!!");
	}

	if (!chunk)
	{
		HTRequest_delete(request);
		fprintf(stderr,"error retrieving RSS file");
		exit(1);
	}
		
	char* data = HTChunk_toCString(chunk);
	if (data) {
		_rssContents = String(data,False);
	}
	else
	{
		fprintf(stderr,"RSS file is empty!!");
		exit(1);
	}
	
	/*
	 * Clean up
	 */
	HTRequest_delete(request);
	HTProfile_delete();
}


When the URL is well formed and the file is available, everything
goes fine. However, when either of the above conditions fails,
the line marked ---> is never reached? Why is that? Is there some
good documentation/examples of how to catch these errors?

TIA

-Doug

Received on Tuesday, 26 October 1999 02:02:22 UTC