Skip to main content
Known Participant
July 20, 2006
Question

cfhttp and timeout

  • July 20, 2006
  • 5 replies
  • 3401 views
I'm using cfhttp with a timeout value, but how do I know if I timed out?

Can't seem to find any examples online or at the macromedia livedocs. Perhaps, it returns a statuscode 408. How can I test this sort of thing?
This topic has been closed for replies.

5 replies

Inspiring
July 20, 2006
When you use <cfcatch> ColdFusion builds an exception structure named
"cfcatch". This will include the exception type and other data. You
can start by <cfdump var="#cfcatch#"> and it will show all the data
about the exception.

You can also type your <cfcatch type="database"...> blocks. This allows
you to build different exception handling code for different potential
exceptions.

And remember, with <cfhttp...> Receiving a http error is NOT an
exception. As far as <cfhttp> is concerned a result was returned. It
is up to you to examine that result and determine if it is an expected
result or not. You would use the #cfhttp# structure (or other named
structure if using MX7+) to examine the result.

You can use the <cfthrow...> tag if you would like to throw a custom
exception to your try/catch logic based on the result returned by <cfhttp>

HTH


leesiulung2006 wrote:
> Ian,
>
> For some reason your post did not show up the previous time I viewed it
> although you posted before jdeline... wierd.
>
> Anyhow, I turned off throwonerror, but for the future. How do I know that this
> particular timeout error occured and not something else if I use cftry/catch.
> The error type that "catch" catches is not clear (there are only like 10
> different kinds).
>
> In programming languages like java there are exceptions with a type (class)
> that indicates what happened in a try/catch clause.
>
Known Participant
July 20, 2006
duplicate post,

is it me or adobe web site soooo slow....
Known Participant
July 20, 2006
Ian,

For some reason your post did not show up the previous time I viewed it although you posted before jdeline... wierd.

Anyhow, I turned off throwonerror, but for the future. How do I know that this particular timeout error occured and not something else if I use cftry/catch. The error type that "catch" catches is not clear (there are only like 10 different kinds).

In programming languages like java there are exceptions with a type (class) that indicates what happened in a try/catch clause.
July 20, 2006
<CFOUTPUT>#CFHTTP.FileContent#</CFOUTPUT> will show you the 408 error. Go to http://livedocs.macromedia.com/coldfusion/5.0/CFML_Reference/Tags47.htm#1632966 for more information.
Known Participant
July 20, 2006
jdeline,

I am aware of the filecontent and the return value of cfhttp. However, can I assume that after the "call" to cfhttp tags the cfhttp.Responseheader.Status_Code will always be filled out afterwards? Is this how I get notified of a 408 Timeout?

Seems like the documentation although available seems to be missing detailed information about how to handle things or it is me who is not as familiar with how html pages with headers etc... are handled.

thanks jdeline!
Inspiring
July 20, 2006
If the cfhttp call times out it throws an ColdFusion Exception (Unless
the don't throw exception option is selected IIRC). You would handle
this with any of the ColdFusion Exception handling features.

<cftry...><cfcatch...>

And|Or

<cferror>

And|Or

The Administrator Error settings

To name a couple.

leesiulung2006 wrote:
> I'm using cfhttp with a timeout value, but how do I know if I timed out?
>
> Can't seem to find any examples online or at the macromedia livedocs. Perhaps,
> it returns a statuscode 408. How can I test this sort of thing?
>