3 ms·
Some form of catch guards have been implemented in Firefox for over a decade, so if you were running SpiderNode, you could use them right now. try {
by carussell 11y ago
Some form of catch guards have been implemented in Firefox for over a decade, so if you were running SpiderNode, you could use them right now.
try {
(17).toString(42);
}
catch (ex if ex instanceof RangeError) {
console.log("caught");
}
catch (ex) {
console.log("handling something else");
}
The if's clause has standard standard conditional semantics, so you can use any expression there; you aren't limited to selecting on the exception's prototype:
try {
throw new Error("whatever");
}
catch (ex if ex.message == "whatever") {
console.log("caught");
}
- tracker1 11y agoWell, it's entirely possible to submit that as a stage-0, then it could get in babel and be used sooner than later.