This commit is contained in:
Ilya Kantor 2017-04-18 00:26:35 +02:00
parent 57dc058c49
commit f57be1bbb3
5 changed files with 221 additions and 46 deletions

View file

@ -0,0 +1,13 @@
The answer is: **no, it won't**:
```js run
new Promise(function(resolve, reject) {
setTimeout(() => {
throw new Error("Whoops!");
}, 1000);
}).catch(alert);
```
As said in the chapter, there's an "implicit `try..catch`" around the function code. So all synchronous errors are handled.
But here the error is generated not while the executor is running, but later. So the promise can't handle it.