summaryrefslogtreecommitdiff
path: root/ext/web/02_timers.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/web/02_timers.js')
-rw-r--r--ext/web/02_timers.js16
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.