Comment on Designing Javascript APIsComments−potkor13y> Developers should never have to use a try-catch.Is the "no exceptions" rule common in Javascript? Are exceptions trouble in JS for some technical reason compared to eg Python?−ville13ySince continuation-passing style is so popular in asynchronous code, errors are typically passed to the callback instead of throwing them. If an error was thrown in, say, a callback for an XMLHttpRequest the original caller would not catch it.
Comments
> Developers should never have to use a try-catch.
Is the "no exceptions" rule common in Javascript? Are exceptions trouble in JS for some technical reason compared to eg Python?
Since continuation-passing style is so popular in asynchronous code, errors are typically passed to the callback instead of throwing them. If an error was thrown in, say, a callback for an XMLHttpRequest the original caller would not catch it.