ES2019 introduces the optional catch binding syntax. This allows us to catch errors without assigning the error to a variable. In this lesson, we'll investigate cases where it's appropriate to catch errors without propagating them further. Then we'll introduce an optional catch binding to make our intent clear.
I didn't even know that previously you were required to bind the error. I'm used to binding it and then choosing whether or not to use it in the statement body. Frankly it surprises me that the requirement was in place, since I don't believe you are (or were) required to bind an event to your event handler. But perhaps catch
is a special case, and that's the "controversy" referenced in the video. What a subtle functionality change.
The video is pretty short, but it could be even shorter. I appreciate the intention to present the problem and solution within a real-world context, but that isn't necessary to demonstrate the new syntax, and the usage of a framework and the discussion of the app's functionality (beyond the try/catch) distract from and bog down the point. This could be a great 30s.
Thanks for the feedback!