ColdFusion 8.0.1 change to CFEXECUTE

This post is more than 2 years old.

I haven't seen this discussed yet, so I thought I'd bring it up (for those of you too lazy to read the release notes, and you know who you are!). One of the cool changes to ColdFusion 8.0.1 is the addition of the errorVariable and errorFile attributes to the cfexecute tag. As you can guess, this helps record any errors that may return from your external process. Before this change, there was no way to get the error. Here is a simple example:

<cfexecute name="#variables.bin#" arguments="#realcommand#" variable="result" timeout="99" errorVariable="errorv"/>

<cfif len(errorv)> Handle the error... <cfelse> Handle the good result... </cfif>

Pretty simple, right? One thing to watch out for is that you cannot use both errorVariable and errorFile. So if you want programatic access to the error and you want to log it - simply use errorVariable and then follow it up with a fileWrite() to save the string.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA