Well the whole idea of cfcatch is so that it "catches" the error. So if it
didn't why not just put after cfcatch that the file was succesfull. There
should be a cfabort in there also, just in case you have any other code that
runs only if the cfcatch was successful. That's what I do.

<cftry>
        <cffile action="WRITE" ......>
        <cfcatch type="Any">
                The file could not be updated. File is locked or read only.
        <cfabort>
        </cfcatch>

</cftry>
The file updated.


Robert Everland III
Network Administrator
Orlando.com

-----Original Message-----
From: Duane Boudreau [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 29, 2000 3:07 PM
To: [EMAIL PROTECTED]
Subject: RE: CFTry Question


Thanks David

this works but I was kind of hoping it worked more like CFIF or CFSWITCH
like below

<cftry>
        <cffile action="WRITE" ......>
        <cfcatch type="Any">
                <cfset success = false>
                The file could not be updated. File is locked or read only.
        </cfcatch>
        <cfcatch type="NoError">
                The file updated.
        </cfcatch>
</cftry>




Cheers,
Duane




-----Original Message-----
From: David Gassner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 29, 2000 1:12 PM
To: [EMAIL PROTECTED]
Subject: RE: CFTry Question


How about...

<cfset success=true>
<cftry>
        <cffile action="WRITE" ......>
        <cfcatch type="Any">
                <cfset success = false>
                The file could not be updated. File is locked or read only.
        </cfcatch>
</cftry>

<cfif success>
        ....Display success message...
</cfif>

> I have wrapped cftry around a cfflile call to intercept error messages if
> the file can not be updated but I want to return a success message if the
> was no errors. Here is what I have:
>
> <cftry>
>       <cffile action="WRITE" ......>
>       <cfcatch type="Any">
>               The file could not be updated. File is locked or read only.
>       </cfcatch>
> </cftry>
>

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to