diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-04-13 10:50:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 11:50:57 +0200 |
commit | 4d18f558e4cfebc5b8d9d594401e3ce74fc3226b (patch) | |
tree | ad13a194d22b3318cf862d9ae5214143f891930a /ext/web/02_timers.js | |
parent | d621ce1cf01ea9bb5562ea3bbed7c2d1db799c91 (diff) |
feat(ext/web): Add error events for event listener and timer errors (#14159)
- feat: Add handleable error event for even listener errors
- feat: Add handleable error event for setTimeout()/setInterval() errors
- feat: Add Deno.core.destructureError()
- feat: Add Deno.core.terminate()
- fix: Don't throw listener errors from dispatchEvent()
- fix: Use biased mode when selecting between mod_evaluate() and
run_event_loop() results
Diffstat (limited to 'ext/web/02_timers.js')
-rw-r--r-- | ext/web/02_timers.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js index 808d99563..edad89ace 100644 --- a/ext/web/02_timers.js +++ b/ext/web/02_timers.js @@ -21,6 +21,7 @@ TypeError, } = window.__bootstrap.primordials; const { webidl } = window.__bootstrap; + const { reportException } = window.__bootstrap.event; const { assert } = window.__bootstrap.infra; function opNow() { @@ -139,13 +140,16 @@ // 2. // 3. - // TODO(@andreubotella): Error handling. if (typeof callback === "function") { - FunctionPrototypeCall( - callback, - globalThis, - ...new SafeArrayIterator(args), - ); + try { + FunctionPrototypeCall( + callback, + globalThis, + ...new SafeArrayIterator(args), + ); + } catch (error) { + reportException(error); + } } else { // TODO(@andreubotella): eval doesn't seem to have a primordial, but // it can be redefined in the global scope. |