From 31d83f5542ce8742fb3a85a414ad0637c8588d53 Mon Sep 17 00:00:00 2001 From: dbachko Date: Sat, 13 Mar 2021 10:54:10 +0200 Subject: [PATCH] doc: fix AbortError example for timers PR-URL: https://github.com/nodejs/node/pull/37738 Reviewed-By: Darshan Sen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Zijian Liu Reviewed-By: Pooja D P --- 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'); });