summaryrefslogtreecommitdiff
path: root/runtime/js/40_fs_events.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-02-01 18:06:11 +0100
committerGitHub <noreply@github.com>2022-02-01 18:06:11 +0100
commit8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch)
tree94c7d6eb2679e641f59cf78640340f5b7af0022e /runtime/js/40_fs_events.js
parentabf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff)
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'runtime/js/40_fs_events.js')
-rw-r--r--runtime/js/40_fs_events.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js
index 27825eaac..939d3ac7b 100644
--- a/runtime/js/40_fs_events.js
+++ b/runtime/js/40_fs_events.js
@@ -3,9 +3,10 @@
((window) => {
const core = window.Deno.core;
- const { errors } = window.__bootstrap.errors;
+ const { BadResourcePrototype, InterruptedPrototype } = core;
const {
ArrayIsArray,
+ ObjectPrototypeIsPrototypeOf,
PromiseResolve,
SymbolAsyncIterator,
} = window.__bootstrap.primordials;
@@ -28,9 +29,11 @@
? { value, done: false }
: { value: undefined, done: true };
} catch (error) {
- if (error instanceof errors.BadResource) {
+ if (ObjectPrototypeIsPrototypeOf(BadResourcePrototype, error)) {
return { value: undefined, done: true };
- } else if (error instanceof errors.Interrupted) {
+ } else if (
+ ObjectPrototypeIsPrototypeOf(InterruptedPrototype, error)
+ ) {
return { value: undefined, done: true };
}
throw error;