Last Updated: 12/07/2011 10:51:00 AM

How to use showerror with cfabort in CFScript

How to use showerror with cfabort in CFScript

 

with CFabort you display a custom error message when the page aborts this way: 

<cfabort showerror="My Fail Whale message">

 

But how do you do it in cfscript? You may think to use showerror="" but you would be wrong.  You would get this:

 

 

 

 

Instead you should use this: 

<cfscript>

    abort "My Fail whale message"

</cfscript>

 

Will give you the expected result:

 

 

The reason for this is that showerror is the only attribute that cfabort takes so this method of taking showerror without naming it specifically cuts down on typing and verbosity.