Framework 1 global exception handling

26 views
Skip to first unread message

Karen Payne

unread,
Mar 22, 2018, 1:12:44 PM3/22/18
to framework-one
I'm working on a application were depending on the run time exception I get different information back from views.main.error.cfm.


Here is error.cfm

<cfoutput>
 
<p>We're sorry. There was a problem.<br /><br />
 
<a href="#rc.fw.ocsLink#">Please return to the home page and try again</a> <!---  --->
 
</p>


 
<cfif rc.this_server_mode EQ 'DEV'>
 
<div class="error">
 
<cfif structKeyExists( request, 'failedAction' )>
               
<!--- sanitize user supplied value before displaying it --->
 
<b>Action:</b> #replace( request.failedAction, "<", "&lt;", "all" )#<br/>
 
<cfelse>
 
<b>Action:</b> unknown<br/>
 
</cfif>


 
<b>Error:</b> #request.exception.cause.message#<br/>
 
<b>Type:</b> #request.exception.cause.type#<br/>
 
<b>Details:</b> #request.exception.cause.detail#<br/>
 
</div>


 
<!--- <Cfset callStackGet()> --->
 
<cfdump var="#callStackGet()#">


 
<cfdump var="#rc#">
 
</cfif>


<cfmail to="#rc.fw.mailto#" from="#rc.ip_addy" subject="claim error" type="html">
 
<cfif structKeyExists( request, 'failedAction' )>
       
<!--- sanitize user supplied value before displaying it --->
 
<b>Action:</b> #replace( request.failedAction, "<", "&lt;", "all" )#<br/>
 
<cfelse>
 
<b>Action:</b> unknown<br/>
 
</cfif>
 
<b>Error:</b> #request.exception.cause.message#<br/>
 
<b>Type:</b> #request.exception.cause.type#<br/>
 
<b>Details:</b> #request.exception.cause.detail#<br/>


 
<cfdump var="#rc#" label="rc">
</cfmail>


</cfoutput>


To replicate the behavior of sometimes getting correct exception information back I use the following code block where rc.messages,pleaseCall is valid.

In a view page
<p>#rc.messages.pleaseCall#</p>

Now I change it to be invalid

<p>#rc.messages.pleaseCall===#</p>

This returns correct information




Now let's change the code

<p>#rc.messages.pleaseCall000#</p>

This time all information such as line number does not show up and nothing for "details"





Question: Any idea why the difference in error reporting in regards to why if I invalidate the member in RC that the information returns line number or does not return line number plus the missing details?

Thanks for any thoughts on this.





Sean Corfield

unread,
Mar 22, 2018, 10:31:14 PM3/22/18
to framew...@googlegroups.com

Because one of these is a syntax error triggered when the file containing the error is read by CFML, the other is a runtime error – CFML reports those differently (so this is really nothing to do with FW/1’s code).

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 


From: framew...@googlegroups.com <framew...@googlegroups.com> on behalf of Karen Payne <karenpay...@gmail.com>
Sent: Thursday, March 22, 2018 10:12:43 AM
To: framework-one
Subject: [framework-one] Framework 1 global exception handling
 
--
FW/1 documentation: http://framework-one.github.io
FW/1 source code: http://github.com/framework-one/fw1
FW/1 chat / support: https://gitter.im/framework-one/fw1
FW/1 mailing list: http://groups.google.com/group/framework-one
---
You received this message because you are subscribed to the Google Groups "framework-one" group.
To unsubscribe from this group and stop receiving emails from it, send an email to framework-on...@googlegroups.com.
Visit this group at https://groups.google.com/group/framework-one.
For more options, visit https://groups.google.com/d/optout.

Karen Payne

unread,
Mar 26, 2018, 9:49:16 AM3/26/18
to framework-one
Thanks Sean!!!
Reply all
Reply to author
Forward
0 new messages