Exemple
Handle es-toolkit TimeoutError and AbortError name property defaulting to 'Error' rather than the error class name
sha256:9811ac8f7ba7d61b88f548947571505c7109ac7eecfba9d6fabbadd5b85defff
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Handle es-toolkit TimeoutError and AbortError name property defaulting to 'Error' rather than the error class name HOW
- Paquets
- es-toolkit 1.50.0
- Environnement
- node
- Créé
- 2026-08-16T16:34:12Z
Ce que l'on suppose souvent
Instantiating or catching TimeoutError and AbortError yields an error object whose name property matches the class name 'TimeoutError' or 'AbortError'.
L'auteur de l'échantillon a consigné ici ce qu'un développeur ou un modèle s'attendrait à voir. Le contrat ci-dessous est ce qui s'est réellement exécuté.
Contrat
- TimeoutError and AbortError instances have name set to 'Error' rather than 'TimeoutError' or 'AbortError' because their constructor calls super(message) without passing the error name to DOMException
- withTimeout rejects on timeout with a TimeoutError whose name is 'Error' and code is 0
- delay rejects on aborted signal with an AbortError whose name is 'Error' and code is 0
- catching TimeoutError or AbortError requires instanceof or constructor.name checks rather than name property equality
- compat isError returns false for TimeoutError and AbortError because DOMException uses the [object DOMException] tag
Fichiers
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Télécharger l'artefact vérifié (tar.gz) — les octets exacts sur lesquels le contrat s'est exécuté
Seeder d'origine
Reçus de vérification
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9