8 Replies Latest reply on Jun 5, 2009 6:39 AM by ilssac

    Site-Wide Error Handler Filepath

    kodemonki Level 1

      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:






      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?



        • 1. Re: Site-Wide Error Handler Filepath
          ilssac Level 5

          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.

          • 2. Re: Site-Wide Error Handler Filepath
            kodemonki Level 1

            \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.

            • 3. Re: Site-Wide Error Handler Filepath
              ilssac Level 5

              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.

              • 4. Re: Site-Wide Error Handler Filepath
                kodemonki Level 1

                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.

                • 5. Re: Site-Wide Error Handler Filepath
                  ilssac Level 5

                  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.


                  • 6. Re: Site-Wide Error Handler Filepath
                    mack_ Level 3

                    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).



                    • 7. Re: Site-Wide Error Handler Filepath
                      kodemonki Level 1

                      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.

                      • 8. Re: Site-Wide Error Handler Filepath
                        ilssac Level 5
                        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.