Skip to content

Commit 9e66896

Browse files
authored
fix: translate title && revert code text
1 parent d76ab23 commit 9e66896

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • 1-js/11-async/08-async-await/02-rewrite-async-2

1-js/11-async/08-async-await/02-rewrite-async-2/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Rewrite "rethrow" async/await
2+
# async/await 来重写「rethrow」
33

44
下面你可以看到 <info:promise-chaining> 章节中的「rethrow」例子。让我们来用 `async/await` 来替换 `.then/catch`
55

@@ -27,16 +27,16 @@ function loadJson(url) {
2727

2828
// 查询用户名直到 github 返回一个合法的用户
2929
function demoGithubUser() {
30-
let name = prompt("输入用户名?", "iliakan");
30+
let name = prompt("Enter a name?", "iliakan");
3131

3232
return loadJson(`https://api.github.com/users/${name}`)
3333
.then(user => {
34-
alert(`用户名为: ${user.name}.`);
34+
alert(`Full name: ${user.name}.`);
3535
return user;
3636
})
3737
.catch(err => {
3838
if (err instanceof HttpError && err.response.status == 404) {
39-
alert("没有该用户,请重新输入。");
39+
alert("No such user, please reenter.");
4040
return demoGithubUser();
4141
} else {
4242
throw err;

0 commit comments

Comments
 (0)