I am having an issue in CF8 that I did not see in earlier versions. Consider
this code inside a function in a CFC:
<cfscript>
var err1 = 0;
try {
some code here;
} catch (Any err1) {
some code here;
}
</cfscript>
In CF8, I am getting the error "Cannot declare local variable err1 twice" when
I try to instantiate the CFC. Of course, I get no error if I get rid of the var
err1 = 0 line, but is this thread-safe? (Changing the variable declaration to
"var err1 = structtNew() doesn't work either.)
GArlington - 07 Sep 2007 16:54 GMT
> I am having an issue in CF8 that I did not see in earlier versions. Consider
> this code inside a function in a CFC:
[quoted text clipped - 12 lines]
> err1 = 0 line, but is this thread-safe? (Changing the variable declaration to
> "var err1 = structtNew() doesn't work either.)
It behaves the same way in CF7.
Error var is by default local (it is created only if error occurs ->
no need to define as local.
PaulH **AdobeCommunityExpert** - 07 Sep 2007 17:17 GMT
> In CF8, I am getting the error "Cannot declare local variable err1 twice" when
if you believe the error message cf8's handling the err1 var as local for you.
jsmcmullen - 07 Sep 2007 18:37 GMT
Well, that's just it. Can I trust that CF8 is handling it as local for me? Does anyone know?
PaulH **AdobeCommunityExpert** - 07 Sep 2007 18:48 GMT
> Well, that's just it. Can I trust that CF8 is handling it as local for me? Does anyone know?
cf's telling you that it is. i was being facetious about trusting the error message.
jsmcmullen - 07 Sep 2007 19:05 GMT
Okay, that's cool. Thanks.
(I never understood why you have to pass in an error variable there anyway.
You don't have to in the cfcatch tag -- only in the cfscript -- and it isn't a
variable that you actually populate beforehand.)
PaulH **AdobeCommunityExpert** - 08 Sep 2007 03:17 GMT
> (I never understood why you have to pass in an error variable there anyway.
> You don't have to in the cfcatch tag -- only in the cfscript -- and it isn't a
> variable that you actually populate beforehand.)
i imagine for you to control & it's not like cfcatch where the var is already
reserved (cfcatch struct).