RajVish
RajVish

Reputation: 191

Coldfusion: How to handle cfftp exceptions

I'm using Coldfusion version:8. I need to handle cfftp exceptions, which handles invalid credentials, connection timeout, no upload permissions, no delete permissions. what is the exact defined runtime exception for cfftp tag in Coldfusion.

Upvotes: 0

Views: 515

Answers (2)

Alex
Alex

Reputation: 7833

Exception handling isn't going to help you if your request is served by the targeted webserver. Exceptions are only thrown if something unexpected occures while trying to send the request by ColdFusion, i.e. outgoing firewall blocks your request or any other kind of connection issue.

The only thing you need is the CFHTTP struct variable that is always generated after calling the tag. This struct contains all data related to the actual HTTP response. (Keeping the request within <cftry>/<cfcatch> is still suggested though.)

Here's an example requesting a non-existent website (404 Not Found) on Tomcat/Railo:

CFHTTP result example

Upvotes: 1

Michael Giovanni Pumo
Michael Giovanni Pumo

Reputation: 14774

Try using cftry tag:

<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

Upvotes: 2

Related Questions