<cftry>
<cfhttp method="Get" url="#job_url#" path="#expandPath("leads\.")#"
file="#reference#">
<cfcatch type="Any">
<cfset StatusCode = DateFormat(Now(),"dd-mmm-yy") & " [" &
#CFHTTP.statusCode# & "]">
</cfcatch>
</cftry>
However, neither the CFCATCH nor the CFHTTP.statusCode seems to work.
Errors occur, the page goes on processing, but no flags are being
thrown.
Any assistance with this would be greatly appreciated.
-Ranger
Would v.7.01 offer me the answer to my problem? I thought
cftry-cfcatch was introduced
in v4.5 and quite mature.
> <cftry>
> <cfhttp method="Get" url="#job_url#" path="#expandPath("leads\.")#"
> file="#reference#">
> <cfcatch type="Any">
> <cfset StatusCode = DateFormat(Now(),"dd-mmm-yy") & " [" &
> #CFHTTP.statusCode# & "]">
> </cfcatch>
> </cftry>
> However, neither the CFCATCH nor the CFHTTP.statusCode seems to work.
> Errors occur, the page goes on processing, but no flags are being
> thrown.
Why would the page not go on processing? What do you mean by "no
flags are being thrown"?
--
Bob Dively | I used to be indecisive, but now I'm not sure...
try/catch will not trap errors at the URL you are <CFHTTPing>, which is
what it seems you're wanting it to do.
There is *no* common ground / overlap between HTTP and CF processing.
<CFHTTP> makes an HTTP request. It captures the HTTP (note: NOT *CF*)
response. Even if the URL it requests causes a CF problem on the remote CF
server, the remote *HTTP* server (eg: Apache, IIS) will still respond with
a HTTP 200 status, which is "OK". The content of the response might have a
CF error in it, but from an HTTP standpoint, everything went fine.
If you're expecting <cfhttp> to analyse / react to CF errors on the remote
server, you might have to revise your logic.
I have never experienced <cfhttp> reporting HTTP statuses incorrectly.
--
Adam
I don't think that CFHTTP is malfunctioning; it's most likely the code
I am using. But I thought the specific exceptions list, exceptions
like, "COMCOM.Allaire.ColdFusion.HTTPConnectionTimeout", would catch
the a failed connection error and allow me to taken action on it.
Please let me know if this or some other method is available. Thanks,
Rick
It's not *throwing* that error. Perhaps internally (ie: within the code
for <cfhttp>) it could well be, but <cfhttp> wraps all that. A failed
connection is NOT an exception as far as CF / CFHTTP goes, so there's
nothing to catch.
> the a failed connection error and allow me to taken action on it.
> Please let me know if this or some other method is available. Thanks,
All the info you need is returned by <cfhttp>. You don't need to be
catching exceptions: it's done for you already. Just work with the status
codes returned by <cfhttp>.
--
Adam