mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: log more info on HTTP error (#4917)
This commit is contained in:
5
.changeset/curvy-feet-applaud.md
Normal file
5
.changeset/curvy-feet-applaud.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/fetch": patch
|
||||
---
|
||||
|
||||
Some HTTP errors should not be retried [#4917](https://github.com/pnpm/pnpm/pull/4917).
|
||||
@@ -10,6 +10,11 @@ interface URLLike {
|
||||
href: string
|
||||
}
|
||||
|
||||
const NO_RETRY_ERROR_CODES = new Set([
|
||||
'SELF_SIGNED_CERT_IN_CHAIN',
|
||||
'ERR_OSSL_PEM_NO_START_LINE',
|
||||
])
|
||||
|
||||
export type RequestInfo = string | URLLike | Request
|
||||
|
||||
export interface RequestInit extends NodeRequestInit {
|
||||
@@ -42,6 +47,9 @@ export default async function fetchRetry (url: RequestInfo, opts: RequestInit =
|
||||
return
|
||||
}
|
||||
} catch (error: any) { // eslint-disable-line
|
||||
if (error.code && NO_RETRY_ERROR_CODES.has(error.code)) {
|
||||
throw error
|
||||
}
|
||||
const timeout = op.retry(error)
|
||||
if (timeout === false) {
|
||||
reject(op.mainError())
|
||||
|
||||
Reference in New Issue
Block a user