pf » Spelling Strikes Again

Spelling Strikes Again

coldfusion

I have been racking my brain trying to figure out why I kept getting this error:

"Element CACHE is undefined in APPPLICATION."

My first thought was that somehow the CACHE variable was being deleted from the application structure, somewhere in the code. It didn't make any sense all my other application variables worked just fine.

Finally I realized that I had spelled APPLICATION with 3 P's!

The tricky part about debugging this one was that the line of code that had the typo was only executed on certain conditions.

So how many times have you made a similar mistake? I wouldn't be surprised if a majority of all my debugging is due to typo's.

I think there is actually some room here for a better error message for this type of exception in ColdFusion. The way the error message is written you would think that CACHE is the problem not APPPLICATION. Maybe something like this would be better:

APPPLICATION is undefined. Please check the spelling.

I'm not trying to blame ColdFusion for my mistake, just suggesting an area where error messages could be improved. Error messages almost always have room for improvement.



Related Entries
This entry was:

Trackback Address: 659/91759332AC0BCF0C0B29A99969B87403
On 11/16/2007 at 7:23:58 AM MST Dan Vega wrote:
1
I think everyone has come across this problem before.I am not sure that there is anything cf could do about this though. How is cf supposed to know that Appplication and ApplicationSomeOther are different.

On 11/16/2007 at 7:31:56 AM MST Pete Freitag wrote:
2
Hi Dan, I think the problem I have with the error message is that it focuses on the structure key, not the structure - which in this case is what is not defined.

On 11/29/2007 at 9:32:48 AM MST James Allen wrote:
3
That's a very good point Peter.

It makes sense to me for CF to point out the highest level variables which aren't defined, rather than pointing at a child which could not exist anyway - or rather presenting the error message in an ambiguous way.

I've had this happen many times.. I think your naturally going to focus on the first variable presented in the error message.

Maybe a better error message would be one that told you the parent which didn't exists and the child element that you were trying to access. That way it would be really easy to locate the problem code. E.G.

APPPLICATION is not defined.

Error occured while attempting to access: APPPLICATION.cache

It's just the simple things that can make the biggest difference to debugging these annoying problems.

On 12/19/2007 at 4:51:02 AM MST Mark wrote:
4
In older versions ColdFusions error messages were much better.

See what you get if you leave a tag with <cfif

Colour coding should catch APPPPLICATION in your IDE.

On 02/15/2008 at 8:52:28 PM MST Tucson Web Design wrote:
5
I hate those little mistakes like that.




  



Spell Checker by Foundeo





Subscribe to my RSS Feed: solosub RSS
Tags