February 18th, 2014, 02:16 PM
I'm setting up a new app in CF 10, and have set up my application.cfc. I created a test page that calls onError() manually, as a test. I get a message saying "onError is not defined", but onError() itself is handling this error, ironically enough. I know this because I have it output a string to indicate that it has fired.
Also, I'm trying to test onError() by intentionally not closing a tag and calling the page. onError() won't fire here; instead I get the standard ColdFusion error grey box.
Any help on these is much appreciated.
February 18th, 2014, 03:10 PM
onError() can only catch runtime exceptions. A syntax error like not closing a tag is a compile error. Which means your code can't even properly compile, so onError() can't catch this. (http://help.adobe.com/en_US/ColdFusi...2c24-7d1b.html ). I believe you'd need to handle this with a site-wide error handler.
February 18th, 2014, 06:13 PM
Thanks Kiteless, I see what's happening now. Do you know if Application.cfc's methods supposed to be callable from the app's cfm pages? I read this post from Ben Nadel's page: http://www.bennadel.com/blog/385-App...BLES-Scope.htm
but I get a method not defined error for both functions when I try his code (even though their access=public).
February 18th, 2014, 06:40 PM
As far as I know, no. That post is really old and obviously things have changed a lot since then. Application CFC methods are basically event handlers that are triggered automatically, so I'm not sure why you'd want to invoke them directly anyway.