cfabort for cfscript

There is a version of this on cflib, but I need a little more. From cfscript, you and pass a whole scope to dump it and stop page execution.

<cfscript>
   cfabort(LOCAL);
</cfscript>

<cffunction name="cfabort">
   <cfargument name="dumpme" required="false"/>
   
   <cfif structkeyexists(arguments,"dumpme")>
      <cfdump var="#arguments.dumpme#"/>
   </cfif>
   
   <cfabort/>
</cffunction>

Comments
Or you could do the following....

<cffunction name="dump" returntype="void" output="true">
<cfdump var="#arguments#" />
</cffunction>

<cffunction name="abort" returntype="void" output="false">
<cfset dump(argumentCollection=arguments) />
<cfabort>
</cffunction>

If you do any component development at all, you these to the base component.
Add the functions to the following to the file <cfinstall dir>\wwwroot\WEB-INF\cftags\component.cfc

Then both abort and dump will be available from any of your components. You would be able to do something like the following.

<cfscript>
someObj = createObject('component', 'path.to.obj');

someObj.dump(avar=structNew());

someObj.dump(var1='abc', var2=arrayNew(1));

someObj.abort('abc', '123', 'somethingsomethingsomething');
</cfscript>
# Posted By JohnEric | 2/12/08 12:14 PM
@John

Good ideas! Much better idea to just dump the whole arguments scope. That would be nice putting the functions into component.cfc too
# Posted By Murloc Oracle | 2/12/08 2:00 PM
These codes have been a great help to me.
Thank you for putting these example on the net!
Alec
# Posted By Alec | 5/5/08 11:03 AM
Quite welcome, Alec
# Posted By Murloc Oracle | 5/6/08 12:56 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner