Highlighted

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

Explorer ,
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

927

Likes

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

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

Explorer ,
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

928

Likes

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
Mar 28, 2016 0
Adobe Community Professional ,
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 (server troubleshooter, carehart.org)

Likes

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
Reply
Loading...
Mar 28, 2016 0
Adobe Community Professional ,
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]

Likes

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
Reply
Loading...
Apr 03, 2016 0
Participant ,
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

Likes

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
Reply
Loading...
Apr 19, 2016 0
Advocate ,
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

Likes

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
Reply
Loading...
Apr 21, 2016 0
A___ LATEST
Participant ,
Apr 21, 2016

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Apr 21, 2016 0
Engaged ,
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

Likes

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
Reply
Loading...
Apr 21, 2016 0