Absolutely:

So, what I have in a file called remote.cfc was this:

<cfcomponent>
<!--- test --->
    <cffunction name="testcall" access="public" returntype="string">
        <cfargument name="uid" default="0" required="false">
        <cfreturn uid>
    </cffunction>
<!--- end test --->
</cfcomponent>

And to test it, I simply called it in a browser window like so: 
http://mydevsite.com/cfc/remote.cfc?method=testcall&uid=2

And for that I got the invalid request was attempted message while I had 
this in my onError method in my Application.cfc:

<cffunction name="onError">
        <cfargument name="Exception" required=true/>
        <cfargument type="String" name="EventName" required=true/>

        <!--- Display an error message if there is a page context. --->
        <cfif NOT (Arguments.EventName IS "onSessionEnd") OR 
(Arguments.EventName IS "onApplicationEnd")>
            <cfoutput>
            <h2>We apologize but an error has occurred.</h2>
            <p>Technical support has been advised of the error.</p>
            <p>Please <a href="/">click here</a> to return to the home 
page.</p>
            </cfoutput>

            <cfmail to="[email protected]" 
from="[email protected]" subject="Error on mydevsite" type="html">
            <p>Error Event: #Arguments.EventName#</p>
            <p>Error details:<br>
            <cfdump var="#arguments.exception#"></p>
            <p>Form: <cfdump var="#form#"></p>
            <p>Session: <cfdump var="#session#"></p>
            </cfmail>
        <cfelse>
            <cfdump>
        </cfif>
        <cfabort>
    </cffunction>

As I mentioned, the call to the method should error when it's set to public 
like it is...I was just curious why I wasn't catching the error is all.  In 
truth, I'll be the only one calling this method from a mobile app I'm 
building...but I don't like having someone able to make a call to my site 
and not being able to handle it gracefully.

On Monday, April 6, 2015 at 11:49:51 AM UTC-4, Craig328 wrote:
>
> Hi all:
>
> Ran into an interesting problem this morning.  I was testing a jQuery call 
> to a remote component method in a dev project I have.  I had neglected to 
> set the method's access attribute to "remote" (it was set to "public") and 
> this was a remote call.  Anyway, when testing access to the CFC function I 
> got the BlueDragon CFML Runtime Error "*an invalid request was attempted*".  
> I understood it and fixed the access attribute but it got me to wondering 
> why my onError method in Application.cfc didn't catch it.  I do have some 
> rudimentary error catching there but it didn't fire.
>
> I thought perhaps I could do a catch/try in the cfc itself (around all the 
> methods) but that didn't do anything either.
>
> I'm sure I'm probably forgetting something fundamental but it's eluding 
> me.  Any ideas/suggestions?
>

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to