About 315,000 results
Open links in new tab
  1. When should you use try/catch in JavaScript? - Stack Overflow

    When I'm developing normal web application with JavaScript, the try/catch statement is not needed usually. There's no checked exception, File IO or database connection in JavaScript. …

  2. Handling specific errors in JavaScript (think exceptions)

    Sep 16, 2009 · Using try-catch-finally.js, you can call the _try function with an anonymous callback, which it will call, and you can chain .catch calls to catch specific errors, and a .finally …

  3. How javascript try...catch statement works - Stack Overflow

    The try catch statement is used to detected for exceptions/errors that are raised inside the try -block. In the catch block you can then react on this exceptional behavior and try to resolve it or …

  4. In Javascript, is it expensive to use try-catch blocks even if an ...

    99 Is it "slow" to use several try-catch blocks when no exceptions are thrown in any of them? My question is the same as this one, but for JavaScript. Suppose I have 20 functions which have …

  5. Can I use a try/catch in JavaScript without specifying the catch ...

    When an exception is thrown in the try -block, exception_var (i.e., the e in catch (e)) holds the exception value. You can use this identifier to get information about the exception that was …

  6. javascript - How to use `throw` properly in try...catch block when ...

    Jul 28, 2022 · How to use `throw` properly in try...catch block when other unexpected errors might occur? Asked 3 years, 4 months ago Modified 3 years, 4 months ago Viewed 7k times

  7. Is try {} without catch {} possible in JavaScript? - Stack Overflow

    As it would seem, no; Javascript requires a try block be followed by either a catch or a finally block. Having said that, there is a way to use those catch blocks to achieve the effect you …

  8. javascript - Try...catch vs .catch - Stack Overflow

    May 28, 2020 · In an async function, promise rejections are exceptions (as you know, since you're using try / catch with them), and exceptions propagate through the async call tree until/unless …

  9. Correct Try...Catch Syntax Using Async/Await - Stack Overflow

    javascript promise async-await try-catch ecmascript-2017 edited Jun 20, 2017 at 23:07 Bergi 671k 162 1k 1.5k

  10. Is there a way to add try-catch to every function in Javascript?

    Jul 31, 2012 · No - you could merely wrap the function's invocation in a try-catch, but not its contents if the function does not actually contain a try-catch. For what it's worth, blanketing …