>How do I return a success from CFTry?

>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>

In the CFCatch block, put in a <cfAbort> at the end of the 'The file could
not be updated...' statement.  That way if there's an error it would stop
there, if not it would pass through to the end...the success message would
appear after the </cfTry>.

You could also use a CFLocation tag within the cfCatch block to redirect to
the error message (and further processing) if the catch block is triggered.

You could:
...
   <cfCatch>
      <cfInclude template="errorMessage.cfm"><cfAbort>
   </cfCatch>
</cfTry>
<cfInclude template="successMessage.cfm">

...HTH. HAND.

Brandon Whitaker
[EMAIL PROTECTED]
-------
"It'll get used by the same people using Opera.  People dressed in black
wearing berets."
- Dave Watts, on Mozilla
"The net interprets censorship as damage and routes around it."
- John Gilmore


------------------------------------------------------------------------------
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