• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Bringing "Variables Scope" in to onError(). Is it Possible?

Explorer ,
Nov 29, 2010 Nov 29, 2010

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

TOPICS
Advanced techniques

Views

616

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 30, 2010 Nov 30, 2010

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

Votes

Translate

Translate
Guide ,
Nov 29, 2010 Nov 29, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 30, 2010 Nov 30, 2010

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 30, 2010 Nov 30, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation