What do you think of this for an onError event handler?

<cffunction name="onError" returnType="void" output="True">
<cfargument name="exception" required="true">
<cfargument name="eventname" type="string" required="true">
<cfset var I = 0>
<cfset var X = "">
<cfset var Tag = "">
<cfset var StackTrace = "">
<!---
http://ray.camdenfamily.com/index.cfm?mode=entry&entry=ED9D4058-E661-02E9-E7
0A41706CD89724 --->
<cfif arguments.exception.type NEQ "coldfusion.runtime.AbortException">
   <cflog file="#This.Name#" type="error" text="Event Name:
#Arguments.Eventname#" >
   <cflog file="#This.Name#" type="error" text="Message:
#Arguments.Exception.message#">
   <cfif NOT ListFind("onApplicationEnd,onSessionEnd",arguments.EventName)>
      <strong>Error:</strong><br>
      <cfif arguments.Exception.Type NEQ "">
         Type: #arguments.Exception.Type#<br>
      </cfif>
      <cfif arguments.Exception.Detail NEQ "">
         Detail: #arguments.Exception.Detail#<br>
      </cfif>
      <cfif arguments.Exception.Errorcode NEQ "">
         Errorcode: #arguments.Exception.Errorcode#<br>
      </cfif>
      <cfif arguments.Exception.ExtendedInfo NEQ "">
         ExtendedInfo: #arguments.Exception.ExtendedInfo#<br>
      </cfif>
      <cfif arguments.Exception.Code NEQ "">
         Code: #arguments.Exception.Code#<br>
      </cfif>
      <cfif arguments.Exception.Message NEQ "">
         Message: #arguments.Exception.Message#<br>
      </cfif>
      <p><strong>Tagcontext:</strong><br>
      <cfloop index="I" from="1"
to="#ArrayLen(arguments.Exception.Tagcontext)#">
         <cfloop collection="#arguments.Exception.Tagcontext[I]#" item="X">
            <cfset Tag = arguments.Exception.Tagcontext[I]>
            #I#. TagContext.#X#: #Tag[X]#<br>
         </cfloop>
      </cfloop>
      </p>
      <cfset StackTrace = Replace(arguments.Exception.StackTrace,"at
coldfusion.","<br /> at coldfusion.","all")>
      <cfset StackTrace = Replace(StackTrace,"at jrun","<br /> at
jrun","all")>
      <p><strong>StackTrace:</strong><br>
      #StackTrace#
      </p>
      <!---<p><cfdump var="#arguments.Exception#"
label="arguments.Exception"></p>--->
   </cfif>
</cfif>
</cffunction>



You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to