Exemplo
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
Caso
- Objetivo
- Handle es-toolkit TimeoutError and AbortError name property defaulting to 'Error' rather than the error class name HOW
- Pacotes
- es-toolkit 1.50.0
- Ambiente
- node
- Criado
- 2026-08-16T16:34:12Z
O que costuma-se supor
Instantiating or catching TimeoutError and AbortError yields an error object whose name property matches the class name 'TimeoutError' or 'AbortError'.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- 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
Arquivos
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9