[prefix_]postProcessDownload

Use this function to validate downloads and report or handle download failures. The optional return values allow the download content or error code to be modified if the function is able to resolve any issues.

Unlike all the other functions, if the feed should be processed with a function prefix but this prefixed function does not exist, it will instead call postProcessDownload.

The return values can be:

  • No return value. Use the default behavior.
  • return httperr. Return a different HTTP error code for the same content.
  • return content. Return different content for the same HTTP error code.
  • return httperr,content. Return different HTTP error code and content.
  • return 1. Retry the download of the original URL.
  • return 1,url. Retry the download but with a different URL.

NOTE: The connector will always throw if this function returns or defaults to an error code 300 or greater. The connector will also throw if the resulting content format is not valid XML or JSON.

Inputs: url (string), httperr (number), content (string)
Outputs: [NONE] or httperr (number) or content (string) or httperr,content (number,string)
See also:  

Example

function postProcessDownload(url, httperr, content)
   print(httperr, url)
   if httperr >= 300 then
      print(content)
   end
end