Error handling with CFFEED?
Hello, does anyone have a suggestion on handling errors from CFFEED reads?
I'm reading an ATOM RSS feed from another site, but if there is ever an issue
with that remote site, it would prevent my page from loading.
If, for example, the RSS feed wasn't available, I would get an "Unable to read
the source URL" error page.
What I would like to have happen would be the page to continue processing, and
instead of displaying the <CFOUTPUT query = "myQuery">, instead display
something like "There was a problem with the newsfeed".
Is there any way to ignore a "fatal error" from a CF tag, and just move on
with processing the rest of the page?
The code I've used here is Adobe's example for the CFFEED tag. The RSS URL I'm
testing with is:
Thanks in advance!
-Ian in Los Angeles
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--- Process the feed data if the user submitted the form --->
<cffeed source = "#theURL#"
properties = "myProps"
query = "myQuery">
<!--- Display the feed output.
Use conditional logic for to handle different feed formats. --->
</cfoutput> <cfoutput query = "myQuery">
<cfif myProps.version IS "atom_1.0">
<h3><a href = "#linkhref#">#title#</a></h3>
<h3><a href = "#rsslink#">#title#</a></h3>
<!--- <p>#content#</p> --->
<!--- The form for specifying the feed URL or file --->
<cfform name = "SetFeed" preserveData = "yes"> Enter Feed URL:
<cfinput type = "text" size = "60" name = "theURL">
<cfinput type = "Submit" name = "submit" value = "Submit">