summaryrefslogtreecommitdiff
path: root/cli/rt
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-07-24 02:33:52 +0100
committerGitHub <noreply@github.com>2020-07-23 21:33:52 -0400
commitb61347b2552cb7159ee3e82c5e9ca5a76e73c3f8 (patch)
treef931a4be2b0435eb3b216813cb946838b9e606bc /cli/rt
parentc2507d95f5a196791bca83630198c064a1fb460a (diff)
fix(cli/js/ops/fs_events): Ignore polling errors caused by return() (#6785)
Diffstat (limited to 'cli/rt')
-rw-r--r--cli/rt/40_fs_events.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/rt/40_fs_events.js b/cli/rt/40_fs_events.js
index ad1fd678f..b9121c155 100644
--- a/cli/rt/40_fs_events.js
+++ b/cli/rt/40_fs_events.js
@@ -2,6 +2,7 @@
((window) => {
const { sendSync, sendAsync } = window.__bootstrap.dispatchJson;
+ const { errors } = window.__bootstrap.errors;
const { close } = window.__bootstrap.resources;
class FsWatcher {
@@ -16,10 +17,17 @@
return this.#rid;
}
- next() {
- return sendAsync("op_fs_events_poll", {
- rid: this.rid,
- });
+ async next() {
+ try {
+ return await sendAsync("op_fs_events_poll", {
+ rid: this.rid,
+ });
+ } catch (error) {
+ if (error instanceof errors.BadResource) {
+ return { value: undefined, done: true };
+ }
+ throw error;
+ }
}
return(value) {