Copy link to clipboard
Copied
Hi all, even though my cferror.cfm file location is recognized by cf admin. The cf admin is not able to call the error file when there is an error... I am using MX 7.2... Any help appreciated...
Copy link to clipboard
Copied
I do something similar, calling the site-wide error page and emailing me the error info. How are you outputting the error itself? Are you sure it exists once CF loads the site-wide error page?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'd guess the cfcatch isn't actually being called? In your cfcatch type="any" block put in some text like "I failed!" instead of setting any variables, see if it gets displayed when an error happens. I usually check for the existence of cferror because calling any values inside of it.
Copy link to clipboard
Copied
How does backgroundcolor get set if there is not an error?
You are setting a variable inside the catch block of a try-catch exception handerler then trying to use that variable later, after the catch block. Thus if no error orrcurs in the <try> block, which has no code in your example so no error can occur, no variable is getting set.
Copy link to clipboard
Copied
I am little lost... can you guys be more specific? How to resolve the issue?
Copy link to clipboard
Copied
Move the code where you display an error message inside your cfcatch block.
Copy link to clipboard
Copied
<cftry>
Any code here will be watched for exceptions, but there is nothing here, so there is really nothing that can ever throw an exception.
<cfcatch type="any">
Code here will be run ONLY if there is an exception thrown in the above section.
<cfswitch expression="#cfcatch.type#">
<cfcase value="template"><cfset backgroundcolor = "lightsteelblue"></cfcase>
<cfcase value="expression"><cfset backgroundcolor = "blanchedalmond"></cfcase>
<cfcase value="database"><cfset backgroundcolor = "linen"></cfcase>
<cfdefaultcase><cfset backgroundcolor = "darkkhaki"></cfdefaultcase>
</cfswitch>
</cfcatch>
</cftry>
<cfset chop = len(GetBaseTemplatePath()) - 9><cfoutput>
<div style="border:solid 1px green; background : #backgroundcolor#;">
<h2>THE REQUESTED PAGE IS TEMPORARILY UNAVAILABLE... PLEASE RE-VISIT IN APPROXIMATELY 30 MINS. </h2>
</div>
</cfoutput>
This code will be run wheter there is an excpetion or not. But it is relying on a variable that is only set if there is an exception, and there is no code in inside the <cftry>...</cftry> block so there is pretty much NO chance of anything ever throwing an exception.
Copy link to clipboard
Copied
Thank you all.