Commit ec419c9
committed
fix(fetch): preserve error code in decompression pipeline for retry logic
When a compressed HTTP response (gzip/br/deflate) encounters a network
error like ECONNRESET during body streaming, the pipeline error callback
and body error handler were wrapping the original error in a new Error,
destroying the .code property. The retry logic in _sendRequestWithRetries
checks e.code !== 'ECONNRESET' to decide whether to retry, so retries
never happened for compressed responses.
Fix: check if the error is a network error (ECONNRESET, EPIPE,
ECONNABORTED) and pass it through unwrapped so the retry logic can see
the code. Only wrap non-network errors as decompression failures.1 parent b949df5 commit ec419c9
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
526 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
527 | 537 | | |
528 | | - | |
529 | 538 | | |
530 | 539 | | |
531 | 540 | | |
| |||
804 | 813 | | |
805 | 814 | | |
806 | 815 | | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
807 | 821 | | |
808 | 822 | | |
809 | 823 | | |
| |||
0 commit comments