Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to re-trigger the default error screen from the onError function in application.cfc using ColdFusion 11?

I use the onError function inside Application.cfc to integrate with RayGun when the code is on live but when we are on dev I'd like to be able to revert back to the normal ColdFusion error event. At the moment I have some basic error handling in place but it isn't as good as the default ColdFusion behavior. Does anybody know if this is possible and how?

I intend to add this as a feature request for ColdFusion 12 if there is no way of doing it.

like image 670
BallisticPugh Avatar asked Jul 03 '15 11:07

BallisticPugh


1 Answers

This works when I run it.

in Application.cfc

<cffunction name="onError" access="public" returntype="void">
<cfargument name="Exception" required=true type="any">
<cfif true>
<cfthrow object="#arguments.exception#">
<cfelse>
error
</cfif>
</cffunction>

in cfm page.

<cfscript>
X=Y;  // Y is undefined
</cfscript>

All you have to do is replace <cfif true> with something that identifies your development environment.

like image 162
Dan Bracuk Avatar answered Sep 21 '22 00:09

Dan Bracuk