application.cfc and onError function

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default application.cfc and onError function

    I have a newly built application.cfc that includes an onError function. As some
    have figured out, the onError function is run whenever there is a CFLOCATION or
    CFABORT in the application's code. A search on these forums found nothing, but
    a search on Google found this:


    onError: When using the onError method, every single <cflocation> call will
    fire the event. Kind of a silly bug, but it didn't get found till too late.
    Christian Cantrell came up with a nice work around to place inside your
    onError:

    <cfif arguments.exception.rootCause eq "coldfusion.runtime.AbortException">
    <cfreturn/>
    </cfif>


    However, when I add this, I get an error that says rootCause is not defined in
    the exception. In fact, the only thing that is defined is the TagContext.

    Anyone have any ideas to prevent these CFLOCATION and CFABORT tags from
    triggering the onError function?

    sdwebguy99 Guest

  2. Similar Questions and Discussions

    1. MX7: Can CFC's use a function in Application.cfm?
      Version CF7 and cf6.1 if possible.... I have built a function inside my Application.cfm file. (a basic error messae with output) I can use said...
    2. dllimport call in aspnet application makes the application hangs
      As our application design requires us to use one of the validation API engine which was written on C(so basically all I have is a dll) and I tested...
    3. Flash MX 2004 Prof - Form application function call question
      I have a flashmx 2004 professional application using forms. I am able to call methods on my application form from child forms with no problem. ...
    4. Shared library / Mach-O: Application crashs if I call a function
      Hi, me again Meanwhile, I can load the shared library in my Mach-O Application and I found my function (BeepTwice) in it. But if I try to call...
  3. #2

    Default Re: application.cfc and onError function

    I am using CFMX7 with hotfix2. I found a solution: it looks like the sample
    code posted will not work. The new sample code below is the real solution--it
    will prevent CFLOCATION from triggering the onError method code.

    <!--- Prevent CFLOCATION and CFABORT from triggering these errors --->
    <cfif StructKeyExists(arguments.exception,"type") and arguments.exception.type
    eq "coldfusion.runtime.AbortException">
    <cfreturn/>
    </cfif>

    sdwebguy99 Guest

  4. #3

    Default Re: application.cfc and onError function

    well, i find a better way for cfabort or cflocation...

    use below of the include or location and replace <cfabort> for

    <cfreturn false>

    No more code XD
    Erick_Rod Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139