New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom error for "no patterns matched"? #64
Comments
It’d be great to add a new error type but past precedent suggests it’ll just be a TypeError. |
I'm just curious what "past precedent suggests" are you referring to? We could make that clearer in the README as well btw. |
Just looking at ES6+ error additions. |
So, Definitely in support of this. |
@xtuc Couldn't you just use the default case to produce whatever kind of expression you like if you actually anticipate values that have no matching case? This way it doesn't so much matter what the thrown error is, because it will usually only arise as a result of a programming mistake. |
@masaeedu I'm just trying to clarify the spec |
Hey y'all! #65 has gotten merged, and a lot of issues have become irrelevant or significantly changed in context. Because of the magnitude of changes and subtle differences in things that seem similar, we've decided to just nuke all existing issues so we can start fresh. Thank you so much for the contributions and discussions and feel free to create new issues if something seems to still be relevant, and link to the original, related issue so we can have a paper trail (but have the benefit of that clean slate anyway). I'll comment on this issue in particular, though, to say that the new spec throws a |
It's written in https://github.com/tc39/proposal-pattern-matching#no-fall-through:
I assume you are referring to
Error
. I think it would be useful to be able to differentiate runtime error thrown in the expressions from the "no patterns matched" error?Note that
throw
could eventually become an expression: https://github.com/tc39/proposal-throw-expressions.The text was updated successfully, but these errors were encountered: