Skip to content

Commit c4183bb

Browse files
dbachkoruyadorno
authored andcommitted
doc: fix AbortError example for timers
PR-URL: #37738 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: Pooja D P <[email protected]>
1 parent 50f3ad1 commit c4183bb

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
@@ -266,7 +266,7 @@ const signal = ac.signal;
266266
setImmediatePromise('foobar', { signal })
267267
.then(console.log)
268268
.catch((err) => {
269-
if (err.message === 'AbortError')
269+
if (err.name === 'AbortError')
270270
console.log('The immediate was aborted');
271271
});
272272

@@ -285,7 +285,7 @@ const signal = ac.signal;
285285
setTimeoutPromise(1000, 'foobar', { signal })
286286
.then(console.log)
287287
.catch((err) => {
288-
if (err.message === 'AbortError')
288+
if (err.name === 'AbortError')
289289
console.log('The timeout was aborted');
290290
});
291291

0 commit comments

Comments
 (0)