Copy link to clipboard
Copied
My error handler page is located at C:\Inetpub\wwwroot\portal\error_handler.cfm but cfadmin (for CF 8) wants a relative path. I've tried:
C:\Inetpub\wwwroot\portal\error_handler.cfm
Inetpub\wwwroot\portal\error_handler.cfm
wwwroot\portal\error_handler.cfm
portal\error_handler.cfm
error_handler.cfm
and http://www.hostname.com/portal/error_handler.cfm
Each time is says the specified file does not exist.
What should the filepath be relative to?
Thanks!
It has to be relative to a ColdFusion mapping OR the ColdFusion web root. The latter has always been the most reliable for me.
It is a little known feature of ColdFusion that it often has two web roots for which it will search for cfml templates. The web root defined for the web server such as c:\inetpub\wwwroot\ that you apparently have. But before searching the web server web root it will search the ColdFusion web root, that on my multi-home flavor of ColdFusion is c:\JRun4\servers\cfusion\c
...Copy link to clipboard
Copied
It has to be relative to a ColdFusion mapping OR the ColdFusion web root. The latter has always been the most reliable for me.
It is a little known feature of ColdFusion that it often has two web roots for which it will search for cfml templates. The web root defined for the web server such as c:\inetpub\wwwroot\ that you apparently have. But before searching the web server web root it will search the ColdFusion web root, that on my multi-home flavor of ColdFusion is c:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\. It is this latter directory that I put my site wide error and missing template handler fiels. Then I just place the file names in the appropiate fields in the administrator.
If you have a default backslash (\) mapping to your web root defined in the ColdFusion administrator, you should be able to input something like "\portal\error_handler.cfm" but I have always had difficulty getting this way to work.
Copy link to clipboard
Copied
\portal\error_handler.cfm worked perfectly! So I created an error and loaded the page and what did I see? The error . . .
Do I need to put something like <cferror type="exception" template="error_handler.cfm" exception="any"> in Application.cfc? It was supposed to display a page just saying the admin has been notified and send me an email with all the error variables.
Copy link to clipboard
Copied
No <cferror...> is a different exception handling feature of ColdFusion that is seperate from the site wide error handler feature.
What was the error and more importantly where was the error? Make sure it is not the error handler code itself that is throwing this exception as it can't catch errors from itself.
Copy link to clipboard
Copied
I just took out a > on my test server in a cfif statement and tried to load the page.
The error is definitely on my test.cfm page, and not on error_handler.cfm.
Copy link to clipboard
Copied
Ok that is a syntax error being thrown at complile time. The site wide exception handler is not going to do anything for that. It is for handling run time exceptions.
Put the closing angle bracket back in and test with this piece of code.
<cfoutput>#ANonExistanctVariable#</cfoutput>
Copy link to clipboard
Copied
Actually the site wide error handler also catches syntax errors or
compile time errors (the onError handler has more limited capabilities
in this regard). If I remember correctly it basically catches all
errors except "hard" errors (jrun out of memory comes to mind).
Mack
Copy link to clipboard
Copied
If that's the case, why am I getting sytax errors to show up?
Also, outputting a non-existant variable just shows the regular "this variable is not defined" error.
Maybe /portal/error_handler.cfm didn't work as perfectly as I thought? I checked the mappings, there's no / mapping and when I tried to add \ it changed it to \/ and said it was invalid. I also added \ and am still getting the syntax errors.
Copy link to clipboard
Copied