From a27534e88373defeb00cb24e4a29a2285a9f0eff 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 ac63d1e63ef7b3..71079343db3aad 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -264,7 +264,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'); }); @@ -283,7 +283,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'); });