I have been working on an project in my spare time that will eventually be deployed on Open BlueDragon. I ran into an error the other night after adding some methods to one my CFCs. I run all three CFML engines side by side (another blog post about that is coming soon), so I was easily able to see and compare the error messages in all three.
This was my error message in OpenBD:
What immediately catches my eye is “Line 13 Column 2” of Application.cfc. So I open that file and see:
As you can see, line 13 is just the opening cffunction tag. I don’t see anything wrong with it, nor anything wrong with the lines around it. So I went back to the error message and scanned for some other files and line numbers. I see that the error message highlighted line 26 in red. Line 26 creates a component from my UserService.cfc file. That line looks ok to me. I also see in the “Detail” section of the error message it says Problem occurred while parsing: followed by several lines of code. Glancing through the code shown I don’t see anything obviously wrong, and I’m not given a line number either.
So I flipped over to Railo to see if that would give me a more useful error message. Here is the output from Railo:
“Syntax Error, Invalid Construct”. Hmmm that isn’t much more helpful. But I do get a different file/line number this time, line 107 of UserService.cfc. Look carefully at that code and you might spot the error, but it just wasn’t registering for me. So I decided to try the code in Adobe ColdFusion8:
Aha! The same line number is referenced, and ColdFusion even gives us the column number and the character at that column that is causing the problem. Looking near the @ sign in that line, the obvious problem is I have a # in that string. # has special meaning in CFML and must be escaped.
I’ve been very impressed with what Railo and OpenBD have brought to the table, but here is one area where they need some work. Had I saw the error in Adobe CF first I would have found my error in seconds. Looking back at the openBD error message now that I know what the problem was, I can see that it is showing me the offending code. But it gets lost in all the other misinformation – pointing out files & line numbers that had me looking in the wrong direction. And no where did it ever mention line 107 of UserService.cfc.
Railo did much better, showing me the exact line with the problem, but not quite as good as Adobe CF8.
Markus Moser says:
Adobe Coldfusion only return the column information for compiler/syntax exception (template exception) not for runtime exception (all others).
when you run code like this, you will not have column info eigther
<cfthrow message="">
greetings Michael
13 July 2009, 10:21 amJeff says:
I had the exact opposite experience in November 🙂
http://www.digitalrewind.com/blog/2008/11/28/Coldfusion-Debug-and-Heap-Space-Errors
Guess it just depends on the error.
15 July 2009, 12:24 am