Skip to content

Commit a27534e

Browse files
dbachkotargos
authored andcommittedMay 1, 2021
doc: fix AbortError example for timers
PR-URL: #37738 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
1 parent 14a160a commit a27534e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎doc/api/timers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const signal = ac.signal;
264264
setImmediatePromise('foobar', { signal })
265265
.then(console.log)
266266
.catch((err) => {
267-
if (err.message === 'AbortError')
267+
if (err.name === 'AbortError')
268268
console.log('The immediate was aborted');
269269
});
270270

@@ -283,7 +283,7 @@ const signal = ac.signal;
283283
setTimeoutPromise(1000, 'foobar', { signal })
284284
.then(console.log)
285285
.catch((err) => {
286-
if (err.message === 'AbortError')
286+
if (err.name === 'AbortError')
287287
console.log('The timeout was aborted');
288288
});
289289

0 commit comments

Comments
 (0)