• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Site-Wide Error Handler Filepath

Engaged ,
Jun 04, 2009 Jun 04, 2009

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!

TOPICS
Getting started

Views

3.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 04, 2009 Jun 04, 2009

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

...

Votes

Translate

Translate
Valorous Hero ,
Jun 04, 2009 Jun 04, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 04, 2009 Jun 04, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 04, 2009 Jun 04, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 04, 2009 Jun 04, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 04, 2009 Jun 04, 2009

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 04, 2009 Jun 04, 2009

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 05, 2009 Jun 05, 2009

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 05, 2009 Jun 05, 2009

Copy link to clipboard

Copied

LATEST
I'll reiterate that I have always had difficulty locating my site-wide error handler anywhere else except inside the ColdFusion web root.

I currenlty have one configured on my development server.  The error handler "test.cfm" is located in my CF root at "C:\\JRun4\servers\cfusion\cfusion.ear\cfusion.war\" directory.  I then just have "/test.cfm" in the site wide error handler field on the ColdFusion Administrator.

This is working fine for me and when I tested it yesterday.  It caught the missing variable exception just fine.  But it did not catch the missing closing tag error.

HTH
Ian

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation