diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-01-27 13:36:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 13:36:36 +0100 |
commit | 884143218fad0e18f7553aaf079d52de703f7601 (patch) | |
tree | 9b9e9d30ea647041438ef8fa974b8d4234cabf73 /runtime/js/40_fs_events.js | |
parent | dcf8f144ab0516936bfa4e93357d71f1732d880e (diff) |
refactor: update runtime code for primordial checks for "instanceof" (#13497)
Diffstat (limited to 'runtime/js/40_fs_events.js')
-rw-r--r-- | runtime/js/40_fs_events.js | 9 |
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; |