From 9bf6d06b2ec4a41b2f5bba75b4b02a6fbb3002cb Mon Sep 17 00:00:00 2001 From: dbachko Date: Sat, 13 Mar 2021 10:54:10 +0200 Subject: [PATCH] Fixes AbortError example for timers --- doc/api/timers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/timers.md b/doc/api/timers.md index 55a948ecb58603..77501fd9fab149 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -266,7 +266,7 @@ const signal = ac.signal; setImmediatePromise('foobar', { signal }) .then(console.log) .catch((err) => { - if (err.message === 'AbortError') + if (err.name === 'AbortError') console.log('The immediate was aborted'); }); @@ -285,7 +285,7 @@ const signal = ac.signal; setTimeoutPromise(1000, 'foobar', { signal }) .then(console.log) .catch((err) => { - if (err.message === 'AbortError') + if (err.name === 'AbortError') console.log('The timeout was aborted'); });