6 Replies Latest reply on Apr 21, 2016 9:18 AM by A***

    How to find where error is occuring on a cfincluded file?

    siriiven Level 1

      I am getting an error on index.cfm on line 424. The problem is that I include several files depending on how the page processes. Index.cfm is not 424 lines long. Is there a way to find out exactly what sub page is tripping the error? I've been over and over this but can't seem to find it.

        • 1. Re: How to find where error is occuring on a cfincluded file?
          Charlie Arehart Adobe Community Professional & MVP

          Yep, it’s a frequent challenge. There may be a solution.

           

          First, are you saying you do or do not have an error handler in place? If you do, does a dump (of the error scope in an app or site-wide error handler, or of the catch scope in a cfcatch) show more detail, including a tagcontext that would indicate the real line in error?

           

          Though this is the “advanced techniques” forum, some people never do learn how to use them. They’re documented in the “Developing ColdFusion Applications” (the user guide in the CF docs), or I did a 4-part series introducing them (and a later article with some updates since then). The concepts (and some challenges) have hardly changed since then.  See:

           

          http://carehart.org/articles/#2006_2

           

          And let us know if that helps.

           

          /charlie

          • 2. Re: How to find where error is occuring on a cfincluded file?
            BKBK Adobe Community Professional & MVP

            siriiven wrote:

             

            I am getting an error on index.cfm on line 424. The problem is that I include several files depending on how the page processes. Index.cfm is not 424 lines long. Is there a way to find out exactly what sub page is tripping the error? I've been over and over this but can't seem to find it.


            Here are some easy, self-explanatory steps to follow:

             

            index.cfm

            <cftry>

            ...

            code, code, code

            ...  

            <cfinclude template="template1.cfm" >

            ...

            code, code, code

            ...  

            <cfinclude template="template2.cfm" >

            ...

            code, code, code

            ...  

            <cfcatch type="any" >

                <cfdump    var="#cfcatch#">

            </cfcatch>

            </cftry>

             

            template1.cfm

            <cftry>

            ...

            code, code, code

            ...  

            <cfcatch type="any" >

                <cfdump    var="#cfcatch#">

            </cfcatch>

            </cftry>

             

            template2.cfm

            <cftry>

            ...

            code, code, code

            ...  

            <cfcatch type="any" >

                <cfdump    var="#cfcatch#">

            </cfcatch>

            </cftry>

             

             

            Three remarks:

            1) the error may be in the Applicatio.cfc or Application.cfm file;

            2) the try-catch is for test purposes and is not meant for production;

            3) with all the cfcatch tags, this example fails the DRY rule but, hey, it is a test and a starting point.

             

            [DRY: Don't Repeat Yourself]

            • 3. Re: How to find where error is occuring on a cfincluded file?
              A***
              • Right click on the web page
              • Select 'View Page Source' from the drop down
              • view-source page opens (i.e. view-source:YourURL)
              • The line numbers are on the left of the source page
              • 4. Re: How to find where error is occuring on a cfincluded file?
                EddieLotter Level 4

                A*** wrote:

                 

                • Right click on the web page
                • Select 'View Page Source' from the drop down
                • view-source page opens (i.e. view-source:YourURL)
                • The line numbers are on the left of the source page

                You are assuming the OP is using the same Web browser that you are. This is not necessarily the case and different browsers have different ways to view the page source. It's best to be as explicit as possible in your instructions to avoid confusion.

                 

                The line numbers you refer to are the line numbers for the rendered HTML, not the line numbers of the ColdFusion code that produced the HTML. This is not useful in this case.

                 

                Cheers

                Eddie

                • 5. Re: How to find where error is occuring on a cfincluded file?
                  Dave Ferguson Level 3

                  Do you have robust exception reporting turned on?  If so you should see the stack trace and it should help point you to where the actual error is.

                   

                  --Dave

                  • 6. Re: How to find where error is occuring on a cfincluded file?
                    A*** Level 1

                    You are right Eddie. The line numbers I referred to earlier are not useful in this case.