As I know, there is no such function in other JavaScript machines.
But using this function, it's easy to convert the code:
try {
A
} catch (e if B) {
C
}
to code that simply uses standard functions supported by all JavaScript mechanisms:
try {
A
} catch (e) {
if (B) {
C
} else {
throw e;
}
}
The example you gave is even easier to translate:
try {
getCustInfo("Lee", 1234, "lee@netscape.com");
} catch (e) {
if (e == "InvalidNameException") {
bad_name_handler(e);
} else if (e == "InvalidIdException") {
bad_id_handler(e);
} else if (e == "InvalidEmailException") {
bad_email_handler(e);
} else {
logError(e);
}
}
source
share