Conditional catch

# Maƫl Nison (4 years ago)

Has the conditional catch clause ever been considered for adoption in the standard? I've stumbled upon them while seeking if there was a better option than the classic "if instanceof / else throw" inside the catch block, and it seems like a really nice syntaxic sugar.

I guess that there might be some issues if the "if" expression itself throws, but that doesn't seem a huge problem (and I guess that the folks at Mozilla have already thought about this?).

// I've just made a search after writing this and before posting it, and I found this thread

However, it is quite old (two years) and a major part of the discussion seems to have shifted to StopIterator - which doesn't exist anymore, right ?

# Kevin Smith (4 years ago)

Is been discussed here several times and it boils down to wanting a generalized pattern matching facility. See Brendan's comment somewhere in that thread.