how to get cfhttp.filecontent when throwonerror=true on cfhttp?

限于喜欢 提交于 2019-12-10 18:01:25

问题


I make a REST service call using cfhttp with the throwonerror attribute set to true. When I use a try/catch statement to capture the error, I can't seem to find a way to output what error the REST service call tried to return, which would reside in the cfhttp.filecontent variable.

I also tried putting the result in a variable. Coldfusion keeps telling me that cfhttp and that variable dont exist. It seems like the call and its result get thrown out the door when an exception is raised.

I've read some advice on setting throwonerror=false and capturing the statuscodes myself, but that seems like silly work. Anyody have any thoughts on this?

<cftry>
    <cfhttp url="#restUrl##arguments.method#/#arguments.params#" charset="utf-8" throwonerror="true" result="haha" />
    <cfcatch type="any">
        <cfdump var="#haha#" />
        <cfdump var="#cfcatch#" abort />
    </cfcatch>
</cftry>

UPDATE: I've submited a bug report to Adobe, as Adamn suggested: https://bugbase.adobe.com/index.cfm?event=newBug. I can confirm it works in Railo, but doesn't work on CF10. Adam could also confirm it doesn't work on CF11.

来源:https://stackoverflow.com/questions/25719926/how-to-get-cfhttp-filecontent-when-throwonerror-true-on-cfhttp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!