I’ve noticed a lot of confusion about the acronym CFML (Coldfusion Markup Language) in connection with the other well-known acronym CMFL (Cambodian Midget Fighting League). The CMFL had an incident where an African lion defeated, and killed many of 42 midget fighters in a government sanctioned fight, which resulted in an increased status in the already popular league. Consequently, many coldfusion developers should be aware to use the proper tags and extensions that use CFM and not CMF, as such similar and popular acronyms are bound to clash often. I have already come across such errors often in my limited dev experience.
Summary: CF developers, don’t let the CMFL take precedence in your mind over CFML.
You CAN’T throw an error or errors from a cfscript without defining your own throw function. But this is pretty easy to do. Somewhere else in your code, just write a <cfunction name=”throw” etc. and in this function just put a <cfthrow tag that throws the error you want to be thrown. A good practice would be to include a throw function in a utility cfc that you could invoke wherever you needed to throw an error in a cfscript.
See the example code below. Note the interesting syntax for catching in a cfscript where you do catch(ERRORTYPE CFCATCHVARIABLE). So catch(database e), catch(any e) would be some common ones. And then you could access e.Message, e.Detail, etc.
//nothing below the throw would execute in this example.
//But I left the rest for syntax reference.
throw("ExampleErrorType","Example Error message.");
//save the reactor record without interfering with custom transaction
catch (database err)
//if the save fails and the error is a database error, return the error detail.
//otherwise this error will need to be caught by the code calling this code.
If you want to do a rethrow, the following article has a great example.
An error occured while Parsing an XML document.:Content is not allowed in prolog.
This mean coldspring cannot find the xml of an expandPath(), or a config argument. On the init of a bean, the line in the init of the cfc was
the arguemtns.environmentXML came from the xml coldspring config,
My mappings on the server to the path were wrong.
should have been
Error Loading: bean_C15CD3571617EEF37B66D49B00F832B8, The cause of this exception was: java.io.FileNotFoundException: D:\HM\Branches\RanaRana\Coldspring\aop\framework\tmp\bean_C15CD3571617EEF37B66D49B00F832B8.cfc (The system cannot find the path specified).
Weird. You have to manually create the tmp folder under yourColspringInstall\aop\framework
“Unable to invoke CFC – [Macromedia][SQLServer JDBC Driver][SQLServer]The multi-part identifier “yourvariable” could not be bound.”
Your not putting pound signs around a variable name
SET @newOtherID = arguments.newUserID;
SET @newOtherID = #arguments.newUserID#;
faultString “Unable to invoke CFC – [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ‘yourfirstfewcharactersofaguid’.
Your not putting your GUID in quotes
SET @userguid = #arguments.newUserID#;
SET @userguid = '#arguments.newUserID#';
Issue: mydomain.com gets load-balanced and uses multiple servers. CGI.SERVER_NAME will not return ‘mydomain’ but will return ‘sever1’ or ‘server2’ etc.
I want to check the request URL, and if it does not include www, re-locate to www.mydomain/pagerequested?event=eventrequested
//note, in cf documentation – You can combine text and variable names to construct a variable name on the left side of an =
//To construct a variable name this way, all the text on the left side of the equal sign must be in quotation marks.
//The left side of an assignment can’t be a function (So Evaluate wouldn’t work’)
“local.criteria.#local.keysToStruct[local.i]#”=Evaluate(“arguments.criteria.” & #local.keysToStruct[local.i]#);