Re: cftry question
You can use different 'types' of catches. See here for more info, http://www.cfquickdocs.com/cf8/#cfcatch On Wed, Nov 18, 2009 at 8:08 AM, Keith McGee kpmc...@frontiernet.net wrote: I want to catch missing template errors only, for example if a user has a link to an old template I don't want my exception.cfm page to load and notify me I want to load a default template. But if the template page loads and has an error I want the exception.cfm to load and notify me. This is what I tried but this will also catch errors in the page even if it loads cftry cfinclude template=#var1#/#var2#.cfm cfcatch cfinclude template=default.cfm /cfcatch /cftry ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328485 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cftry question
Thanks, I got it to work ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328486 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: CFTry Question
If it doesn't fail, it works. So if it isn't caught, it succeeded. cftry cffile action="WRITE" .. !-- if it failed, execution would drop down to the catch blcok -- It worked! cfcatch type="Any" The file could not be updated. File is locked or read only. /cfcatch /cftry Chris Evans [EMAIL PROTECTED] http://www.fuseware.com -Original Message- From: Duane Boudreau [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 29, 2000 12:45 PM To: CFTalk Subject: CFTry Question Hi all, 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 Duane Boudreau Director, Web Technologies Ektron, Inc. http://www.ektron.com 5 Northern Blvd, Suite 6 Amherst, NH 03031 Tel: 603-594-0249 Fax: 603-594-0258 ICQ#: 18024374 Jobs: [EMAIL PROTECTED] -- Archives: http://www.eGroups.com/list/cf-talk To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=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=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
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=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
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=listsbody=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=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: CFTry Question
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=listsbody=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=listsbody=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=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.