Status/Resolution/Reason: Closed/Withdrawn/Duplicate
Reporter/Name(from Bugbase): Sanjeev Krishna / Sanjeev Krishna (Sanjeev MANDALAPU)
Created: 07/31/2013
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7
Vote Count: 0
Duplicate ID: CF-3605332
Problem Description:
When returning an implicit struct from inside CFCATCH with cfcatch as one of its key value, CF throws an undefined element exception.
<cfscript>
public STRUCT function blah(){
try{
return {success: true, data: 'ColdFusion'};
} catch(Any err){
return {success: false, data: cfcatch.detail};
}
}
</cfscript>
The above code throws an "Detail is undefined in CFCATCH" error even without running the code. This is true for the following also -
return {success: false, data: cfcatch}; //throws "CFCATCH is undefined" error
var err = cfcatch;
return {success: false, data: err}; //throws "err is undefined" error
Steps to Reproduce:
<cfscript>
public STRUCT function blah(){
try{
return {success: true, data: 'ColdFusion'};
} catch(Any err){
return {success: false, data: cfcatch.detail};
}
}
</cfscript>
Actual Result:
Detail is undefined in CFCATCH
Expected Result:
a struct with success:true and data:ColdFusion
Any Workarounds:
Yes. Use explicit struct declaration
<cfscript>
public STRUCT function blah(){
try{
return {success: true, data: 'ColdFusion'};
} catch(Any err){
var ret = structNew();
ret.success = false;
ret.data = cfcatch.detail;
return ret;
}
}
</cfscript>
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3605215
External Customer Info:
External Company:
External Customer Name: elixira
External Customer Email:
External Test Config: My Hardware and Environment details:
ColdFusion 10u10 32bit, Apache as web server and running on a Win7 i5.
Attachments:
Comments: