[Top] [All Lists]

Error handling with CFFEED?

Subject: Error handling with CFFEED?
From: "lizard626"
Date: Mon, 20 Aug 2007 21:47:43 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion
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" 
 <html xmlns="";>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Untitled Document</title>

 <!--- Process the feed data if the user submitted the form --->
 <cfif isDefined("Form.Submit")>
   <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>
       <p><b>Published:</b> #DateFormat(publisheddate)#</p>
       <h3><a href = "#rsslink#">#title#</a></h3>
       <p><b>Published:</b> #publisheddate#</p>
     <!--- <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">


<Prev in Thread] Current Thread [Next in Thread>