Make request errors have original error codes.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
Direzione di ricerca
Read transport.js and locate createError(), which the issue identifies as the place where request errors are wrapped. Preserve the original error code on the resulting error, then verify that timeout and other transport failures expose that code to callers.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The problem
Request errors e.g. ETIMEDOUT don't have status or error code, would be nice to have so we can use them to open a circuit breaker or log out.
Suggested solution
Make transport.js add error code in createError()
createError(err, ctx) {
const error = new Error(`Request failed for ${ctx.req.getMethod()} ${ctx.req.getUrl()}: ${err.message}`);
error.code = err.code;
return error;
}
Alternatives considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
We need to make timeout errors open our circuit breaker, as currently, we only open when we get 100+ 5xx errors. We do get the timeout error, but only as error object, with no error or status code which makes it hard to identify them, would be nice for request errors (e.g. timeout errors) to have error codes to identify them.
- Lingua principale
- JavaScript
- Stelle
- 14
- Fork
- 10
- Merge medio
- 17h 13m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bbc/http-transport
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
bbc/http-transport#46 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
bbc/http-transport#45 · 1 commento ·
-
feature-request
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
bbc/http-transport#35 · 1 reazione ·
-
Migrate to TypescriptApertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bbc/http-transport#33 · 2 reazioni ·
Tutte le issue di bbc/http-transport
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
pedroapfilho/localveil#120 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ImpactMojo/ImpactMojo#1385 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno