我正在使用Coldfusion版本:8。我需要处理cfftp异常,它处理无效凭据,连接超时,没有上传权限,没有删除权限。 Coldfusion中cfftp标记的确切定义的运行时异常是什么。
答案 0 :(得分:2)
尝试使用cftry
代码:
<cftry>
FTP code here.
<cfcatch type="exception type1">
Add exception processing code here.
</cfcatch>
<cfcatch type="exception type2">
Add exception processing code here.
</cfcatch>
<cfcatch type="Any">
Add exception processing code appropriate for all other exceptions here.
</cfcatch>
</cftry>
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Errors_13.html
答案 1 :(得分:1)
如果您的请求由目标网络服务器提供,则异常处理无法帮助您。只有在尝试通过ColdFusion发送请求时发生意外情况时才会抛出异常,即传出防火墙会阻止您的请求或任何其他类型的连接问题。
您唯一需要的是 CFHTTP结构变量,它总是在调用标记后生成。此结构包含与实际HTTP响应相关的所有数据。 (尽管仍然建议将请求保留在<cftry>/<cfcatch>
内。)
以下是在Tomcat / Railo上请求不存在的网站(404 Not Found)的示例: