You ever get this ColdFusion error telling you that you can't have a line break at the end of your document? And then you start deleting extra white space having the ColdFusion compiler tell you that whatever your last document character is, it's invalid? This is an extremely frustrating ColdFusion error because it doesn't really tell you what's going on - if you don't really read the error information!
An invalid token error get thrown when ColdFusion is trying to finish parsing a TAG and either runs out of data (such as the end of the file) or hits a character (token) that is not allowed. For example, this:
- <!--- This is a ColdFusion comment -->
... will throw an invalid token error when it hits the end of the file. Check out the open/close comments. The starting one is a ColdFusion comment tag opener but the ending one is an HTML comment tag closer. ColdFusion obviously ignores the closing comment as it doesn't care about HTML comments and continues parsing through the document looking for a closing comment tag (--->). Then, when it hits the end of the document without finding a closing comment tag it throws the error:
Invalid token 'X' found on line Y at column Z
... where X, Y, and Z are just variants (x = token, y = line, z = column).
While the "message" of the error is crap, please READ READ READ the rest of the ColdFusion error notes. The fine print will usually tell you what's going wrong. For instance, the above error will have this bullet:
The closing tag for the CFML comment is missing. Comment begins on line 267.
It's that easy. I know a lot of the times we see error messages and just start diving in, trying to fix things. But, why waste all that time when the debugging tells you exactly where the error is.
Looking For A New Job?
Ooops, there are no jobs. Post one now for only $29 and own this real estate!