Skip to content

Commit 6b1a301

Browse files
author
Moshiur Rahman
authored
Watcher: Error catching fixed
There was a typo/mistake in the example try-catch block. It should either be `error` in the catch clause or `e` in the statement. ``` try { ..... } catch (error) { answer.value = 'Error! Could not reach the API. ' + error } ```
1 parent 4fb2d4c commit 6b1a301

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/guide/essentials/watchers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
try {
3131
const res = await fetch('https://yesno.wtf/api')
3232
this.answer = (await res.json()).answer
33-
} catch (e) {
33+
} catch (error) {
3434
this.answer = 'Error! Could not reach the API. ' + error
3535
}
3636
}
@@ -81,7 +81,7 @@ watch(question, async (newQuestion, oldQuestion) => {
8181
try {
8282
const res = await fetch('https://yesno.wtf/api')
8383
answer.value = (await res.json()).answer
84-
} catch (e) {
84+
} catch (error) {
8585
answer.value = 'Error! Could not reach the API. ' + error
8686
}
8787
}

0 commit comments

Comments
 (0)