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

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

Explorer ,
Mar 28, 2016 Mar 28, 2016

Copy link to clipboard

Copied

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.

TOPICS
Advanced techniques

Views

1.2K

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
Community Expert ,
Mar 28, 2016 Mar 28, 2016

Copy link to clipboard

Copied

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


/Charlie (troubleshooter, carehart.org)

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
Community Expert ,
Apr 03, 2016 Apr 03, 2016

Copy link to clipboard

Copied

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]

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
Participant ,
Apr 19, 2016 Apr 19, 2016

Copy link to clipboard

Copied

  • 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

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
Advocate ,
Apr 21, 2016 Apr 21, 2016

Copy link to clipboard

Copied

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

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
Participant ,
Apr 21, 2016 Apr 21, 2016

Copy link to clipboard

Copied

LATEST

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

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 ,
Apr 21, 2016 Apr 21, 2016

Copy link to clipboard

Copied

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

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