Copy link to clipboard
Copied
I’m trying to access the Variables scope ( <cfdump var=”#variables#”> ) inside the OnError() in Application.cfc for debugging and logging reasons. Something like this :
<cffunction name="onError" returnType="void" output="true">
<cfargument name="exception" required="true">
<cfdump var=”#variables#”>
</cffunction>
With good old Application.cfm and <cferror> I was able to access Variable Scope, just like URL or Session Scope. But OnError() been a function, it seems don’t have access to Variables Scope. Is there any possibility of bringing Variables Scope in to OnError(), when it triggered? Or is that entirely not possible?
Thanks you in advance for your brain power!
- Sam
Well it's a bit of an architectural change, but if you run your app through an onRequest() event handler, using , then the whole request runs in the memory scope of Application.cfc, so all your request's variables-scoped stuff will be in the same variables scope as exposed to onError().
--
Adam
Copy link to clipboard
Copied
Have you tried using the onError method to simply use a cfinclude on an error handling .cfm page? That page *should* then have access to your variables scope as the page itself will be within the same scope.
I could, however, be awfully wrong.
Copy link to clipboard
Copied
Your suggestion brought me a new train of thought that confirmed by Adam (he always does!). I’m back on track!
Thank you very much guys!
Copy link to clipboard
Copied
Well it's a bit of an architectural change, but if you run your app through an onRequest() event handler, using , then the whole request runs in the memory scope of Application.cfc, so all your request's variables-scoped stuff will be in the same variables scope as exposed to onError().
--
Adam