Skip to content

Commit bbd052a

Browse files
authored
Fixed async / await promise sample error handling
1 parent 08e2dbd commit bbd052a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

readme.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,7 @@ Let's see how we could fetch a github user with promises first:
13111311

13121312
```js
13131313
function getGithubUser(username) {
1314-
return fetch(`https://api.github.com/users/${username}`)
1315-
.then(response => response.json())
1316-
.catch(err => reject(err));
1314+
return fetch(`https://api.github.com/users/${username}`).then(response => response.json());
13171315
}
13181316

13191317
getGithubUser('mbeaudru')

0 commit comments

Comments
 (0)