Skip to content

Commit a0fd40c

Browse files
authored
Merge pull request #2675 from loucadufault/patch-1
Update watch-example.ts to reflect `done` error is conditionally passed
2 parents 9688280 + 9d27385 commit a0fd40c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/typescript/watch/watch-example.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ const req = await watch
2626
}
2727
console.log(apiObj);
2828
},
29-
// done callback is called if the watch terminates normally
29+
// done callback is called if the watch terminates either normally or with an error
3030
(err) => {
31-
console.log(err);
31+
if (err) {
32+
console.error(err);
33+
} else {
34+
console.log('watch finished normally')
35+
}
3236
},
3337
)
3438
// watch returns a request object which you can use to abort the watch.

0 commit comments

Comments
 (0)