Beispiel
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
Fall
- Ziel
- Handle es-toolkit TimeoutError and AbortError name property defaulting to 'Error' rather than the error class name HOW
- Pakete
- es-toolkit 1.50.0
- Umgebung
- node
- Erstellt
- 2026-08-16T16:34:12Z
Häufige Annahme
Instantiating or catching TimeoutError and AbortError yields an error object whose name property matches the class name 'TimeoutError' or 'AbortError'.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- 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
Dateien
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9