Skip to content

Commit

Permalink
Revert "代码遗漏更正"
Browse files Browse the repository at this point in the history
This reverts commit 2bc5dab.
  • Loading branch information
Pingren Nie authored and Pingren Nie committed Jul 31, 2019
1 parent 62c76eb commit da65288
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,21 +649,6 @@ var response = await rp(‘https://api.example.com/endpoint1');
2. **错误处理:** Async/await 使得我们可以使用相同的代码结构处理同步或者异步的错误 —— 著名的 try/catch 语句。让我们看看用 Promises 是怎么实现的:
```js
function loadData() {
try { // Catches synchronous errors.
getJSON().then(function(response) {
var parsed = JSON.parse(response);
console.log(parsed);
}).catch(function(e) { // Catches asynchronous errors
console.log(e);
});
} catch(e) {
console.log(e);
}
}
```
对比:
```js
Expand Down

0 comments on commit da65288

Please sign in to comment.