I am having a problem with site-wide error templates. In the Application.cfc
file I have the following:
<cfcomponent ......
....set the application variables here ....
<cferror type="Request" template="ErrorRequest.cfm"
mailto="#THIS.Dev_email#">
<cferror type="Exception" template="ErrorException.cfm"
mailto="#THIS.Dev_email#">
<cferror type="Validation" template="ErrorValidation.cfm"
mailto="#THIS.Dev_email#">
<cffunction name="onApplicationStart" ......
This works great when an error takes place in the website's root directory.
When this happens, the appropriate error template is run and all is well with
the world ...
The problem occurs when the error occurs in a subdirectory on the site. When
this happens, I get an error message that the error template can't be found ...
Here is the message: Error attempting to resolve the template
"ErrorRequest.cfm". The template could not be found.
What am I doing wrong here???
walkman - 18 Jan 2006 02:00 GMT
I think that I had to create a map first. It was the worst couple days of my
life getting the error pages to work....
Missing Template Handler
/maproot/evirtualluxury/error-redirect.cfm
Site-wide Error Handler
/maproot/openbooker/property/service/cferror.cfm
maproot:
C:\Inetpub\WWWroot\
I don't know much beyond this.
Hope it helps.
UGA_Bulldawg - 30 Jan 2006 14:33 GMT
This is a common problem when you switch to the application.cfc file. Make
sure you use the path in your application.cfc for the error template.
ie. <cferror type="EXCEPTION" template="\dirname\ErrorPage.cfm" mailto="">
hinsbergen - 30 Jan 2006 15:22 GMT
If you have the errorhandler.cfm in a folder called "errors", do:
<cferror type="EXCEPTION" template="/errors/errorhandler.cfm" mailto="">
The leading "/" will solve the problem!
billn - 30 Jan 2006 16:10 GMT
Thanks for the reply, I really appreciate it. I tried your suggestion and it
works great when the error occurs on a page in the website's root directory.
Example:
/index.cfm has a line at the top of it: <cfset a=b+c /> none of these
variables are defined and thus it produces an error and runs the <cferror>
template.
But when I put the <cfset a=b+c /> error in a page that is in a subdirectory,
I get:
Error attempting to resolve the template "/errors/errorRequest.cfm".
The template could not be found.
I believe this is due to ColdFusion not wanting to see absolute path names.
My websites are hosted on a ISP so I can create a map to a specific directory.
Obviously, I am just not getting this yet. Any additional help is appreciated
!!!