From be10c29d1793b47492bf000ce1cc196d000495c2 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 19 Oct 2022 06:27:07 +0200 Subject: [PATCH] fix(http): improve error handling (#17587) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> --- lib/logger/__snapshots__/err-serializer.spec.ts.snap | 1 + lib/logger/utils.ts | 1 + lib/util/http/github.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/logger/__snapshots__/err-serializer.spec.ts.snap b/lib/logger/__snapshots__/err-serializer.spec.ts.snap index 055f13499f..a0a1ff2a1a 100644 --- a/lib/logger/__snapshots__/err-serializer.spec.ts.snap +++ b/lib/logger/__snapshots__/err-serializer.spec.ts.snap @@ -28,6 +28,7 @@ exports[`logger/err-serializer got sanitize http error 1`] = ` "content-type": "application/json", }, "httpVersion": null, + "retryCount": 0, "statusCode": 412, "statusMessage": "Precondition Failed", }, diff --git a/lib/logger/utils.ts b/lib/logger/utils.ts index 90e0e263f7..d787f4f678 100644 --- a/lib/logger/utils.ts +++ b/lib/logger/utils.ts @@ -85,6 +85,7 @@ export default function prepareError(err: Error): Record<string, unknown> { err.name === 'TimeoutError' ? undefined : clone(err.response.body), headers: clone(err.response.headers), httpVersion: err.response.httpVersion, + retryCount: err.response.retryCount, }; } } diff --git a/lib/util/http/github.ts b/lib/util/http/github.ts index 2b0d1f39bc..8de822fba2 100644 --- a/lib/util/http/github.ts +++ b/lib/util/http/github.ts @@ -67,6 +67,7 @@ function handleGotError( message = String(body.message); } if ( + err.code === 'ERR_HTTP2_STREAM_ERROR' || err.code === 'ENOTFOUND' || err.code === 'ETIMEDOUT' || err.code === 'EAI_AGAIN' || -- GitLab