This commit is contained in:
Ilya Kantor 2017-04-17 21:45:55 +02:00
parent a4a16fccd6
commit 57dc058c49
4 changed files with 9 additions and 9 deletions

View file

@ -106,7 +106,7 @@ alert( worker.slow(1) ); // the original method works
worker.slow = cachingDecorator(worker.slow); // now make it caching
*!*
alert( worker.slow(2) ); // WOOPS! Error: Cannot read property 'someMethod' of undefined
alert( worker.slow(2) ); // Whoops! Error: Cannot read property 'someMethod' of undefined
*/!*
```

View file

@ -218,7 +218,7 @@ alert( str.match(reg) ); // <a href="link" class="doc">
let str = '...<a href="link1" class="doc">... <a href="link2" class="doc">...';
let reg = /<a href=".*" class="doc">/g;
// Woops! Two links in one match!
// Whoops! Two links in one match!
alert( str.match(reg) ); // <a href="link1" class="doc">... <a href="link2" class="doc">
```

View file

@ -44,7 +44,7 @@ Or, in case of an error:
```js
let promise = new Promise(function(resolve, *!*reject*/!*) {
// after 1 second signal that the job is finished with an error
setTimeout(() => reject(new Error("Woops!")), 1000);
setTimeout(() => reject(new Error("Whoops!")), 1000);
});
```
@ -82,10 +82,10 @@ promise.then(result => alert(result));
```js run
let promise = new Promise(function(resolve, reject) {
setTimeout(() => reject(new Error("Woops!")), 1000);
setTimeout(() => reject(new Error("Whoops!")), 1000);
});
// shows "Woops!" after 1 second
// shows "Whoops!" after 1 second
promise.catch(error => alert(error.message));
```

View file

@ -212,9 +212,9 @@ For instance:
```js run
new Promise(function(resolve, reject) {
throw new Error("Woops!");
throw new Error("Whoops!");
}).catch(function(error) {
alert(error.message); // Whoops
alert(error.message); // Whoops!
});
## Inheriting from promise, thenables, error handling?
@ -248,11 +248,11 @@ new Promise(function(resolve, reject) {
setTimeout(() => resolve(1), 1000);
}).then(function(result) {
throw new Error("Woops!");
throw new Error("Whoops!");
}).catch(function(error) {
alert(error.message); // Woops!
alert(error.message); // Whoops!
});
```