> I am having an issue displaying my error message whenever my code throws an 
> error. It makes an HTTP request using GET to
> access some XML, and if the status code is not 200 OK, then it should catch 
> that and display the error message. While the
> request is being preformed, there is a "transition" page being displayed to 
> the user. The error-handling works, as I have used
> Fiddler to verify the error and message, but the error content does not show 
> up in the browser. I am using ColdFusion MX7. Here
> is the code:
>
> <pre>
> <cftry>
>    <cfhttp url="#searchurl#" method="GET">
>        <cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0" 
> />
>        <cfif cfhttp.statusCode IS NOT "200 OK" >
>          <cfthrow type="Any" detail="XML not returned" message="XML not 
> returned" />
>        </cfif>
>    </cfhttp>
>    ...
>    <cfcatch type="Any">
>       <div id="error_wrapper">
>         <h1 id='error_title'>The search encountered error(s)</h1>
>         <cfoutput>#cfcatch.detail#</cfoutput></p>
>       </div>
>     </cfcatch>
> </cftry>
> </pre>

The variable CFHTTP.statusCode isn't available until after your CFHTTP
tag. You're using it within that tag.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331033
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to