-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Multi-catch support #30830
Comments
This fails on at least two points from the template that you deleted:
As it would require both extra runtime code to be emitted (generating if...else instanceof code for you) and for that generated code to depend on the type annotations in the source. |
I did read the template, and I was aware of that violations, but I thought the benefit of this approach to write error handling code should be exposed. |
@brunoc107 I think this is a good suggestion, but in parsing we can't handle developer code and parsing code! But maybe we can add a new try/catch keyword like try/match or whatever, what do you think? |
@mikoloism It could be a valid way of allowing "multi-catch" support. I think that would solve the "problem" I had when I first open this issue. |
Hello, everyone
I've been working with typescript quite a wile since i've first found it, and it's one of the coolest piece of technology i've ever used. But I think it could be cooler if we had a better way of handling errors. I mean, we could leverage the functionality of the language's try-catch.
Sometimes we need to handle some errors in specific ways that do not apply to others and the current language does not support a more strait forward way of doing it.
Today, we need to do something like this:
I think it could be better. We could add support to "multi-catch" to the language. The code that follows should be transpiled to the code seen before:
What do you think about it, guys?
I think it would be a joy to see it working!
Regards :)
The text was updated successfully, but these errors were encountered: