Skip to content

Commit f5b87a7

Browse files
authored
Update watch-example.ts to reflect done error is conditionally passed
1 parent ef2953e commit f5b87a7

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.log(err);
33+
} else {
34+
console.log('watch done')
35+
}
3236
},
3337
)
3438
// watch returns a request object which you can use to abort the watch.

0 commit comments

Comments
 (0)