I was wondering if there is a way to not specify the argument when doing a JS try/catch. Every time I try this though, the try/catch doesn’t work. The working version: What I have in mind (No ‘e’): Answer Optional catch binding in 2019 Node.js In Node.js, this feature is called Optional Catch Binding and is supported since Node.js version
Tag: try-catch
Is there a way to add try-catch to every function in Javascript?
For error reporting, I would like to insert a try-catch wrapper around the code of every function I have. So basically I want to replace …with… Is there a way to apply this generic try-catch thing to all functions without manually editing all of them? For example by modifying the prototype of the Function object? EDIT Why I want to
Why does a return in `finally` override `try`?
How does a return statement inside a try/catch block work? I’m expecting the output of this function to be true, but instead it is false! Answer Finally always executes. That’s what it’s for, which means its return value gets used in your case. You’ll want to change your code so it’s more like this: Generally speaking you never want to