Entries for month: April 2007
In Honor of the Victims at Virginia Tech
Posted by David in Announcements on April 30, 2007
Error when cflocation is ran within onRequestStart
Posted by David in ColdFusion on April 24, 2007
There is some code in one of the projects I am working on that checks if a user is logged in within the onRequestStart application function. If the user is not logged in, the code redirects them to the login page using a cflocation. Although there is no visual error, i kept getting error emails thru my onError function stating there was a coldfusion.runtime.AbortException error happening:
An exception occurred when invoking a event handler method from Application.cfc The method name is: onRequestStart.
Reading various posts on this error on the web, I found that the this problem is well known and found some work-arounds. Here is one of them...
Within your onError function you can filter out the AbortException errors by doing this:
<cffunction name="onError" returntype="void">
<cfargument name="exception" required="true">
<cfargument name="eventname" type="string" required="true">
<cfswitch expression="#arguments.exception.rootcause.type#">
<cfcase value="coldfusion.runtime.AbortException">
<!--- do nothing --->
<cfreturn />
</cfcase>
<cfdefaultcase>
<!--- error handling code here --->
<cfdump var="#exception#" label="Exception">
</cfdefaultcase>
</cfswitch>
</cffunction>
That did the trick!

Recent Comments