When I use Closure Compiler I get the following errors when compiling in advanced mode: (in simple- and Whitespace only mode the code gets not problems at all)
JSC_REDECLARED_VARIABLE: Redeclared variable: e at line 31 character 9
} catch (e) {
^
JSC_REDECLARED_VARIABLE: Redeclared variable: e at line 34 character 9
} catch (e) {
^
The code described by Closure Compiler as an error is the following:
function getXMLHttp() {
var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
}
return xmlHttp;
}
Why this problem occurs when I use Advanced mode, I don’t know. I have no idea why the compiler says this is an error as well.
(Quick note: This code is just a simple XMLrequest for an PHP file in a error catch handling for handling IE. All my JavaScript code works as it should be.)
You can easily get rid of it by using
e,e2ande3for your exceptions. That’s dirty but still a good workaround.