#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    43
    Rep Power
    4

    OnError Undefined


    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.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,264
    Rep Power
    968
    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.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    43
    Rep Power
    4
    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).
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,264
    Rep Power
    968
    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.

IMN logo majestic logo threadwatch logo seochat tools logo