Quick question : does anyone declare a catch varia...
# cfml-general
g
Quick question : does anyone declare a catch variable with "var"?
} catch(any var e) {
w
no, it's 'special'. matter of fact, i think you'll get an exception if you do. bottom line, you do not need/want to localize a catch var, to the best of my knowledge
👍 1
👍🏼 1
d
I always thought of it as an argument to the catch() method, can't be var'd like that, but you can declare its type, which I think has to be Any, like you have (minus the 'var').
g
Thanks very much ! I was just going through the code looking for an unscoped var - for a bug - and there was a cfcatch ... and I just thought : "Am I supposed to Var scope them too?" They're not - and I never have.... but just wanted to make sure! Thanks again!
w
you can actually see it better here: the catch variable only exists within the catch block - https://trycf.com/gist/3d22e1dd69fa5b4935eb55264306a873/lucee5?theme=monokai
👍🏼 1