From d7f994308ec3bea5a6b0b95f3594037fb48624ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 4 May 2026 11:17:51 +0200 Subject: [PATCH] drop non-null assertion in retry loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flip the order of the response/error check so TypeScript narrows the types itself rather than relying on `response!` to assert what the code already guarantees by construction. Co-Authored-By: Claude Opus 4.7 (1M context) Signed-off-by: Fredrik Adelöw --- packages/integration/src/gitlab/GitLabIntegration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/integration/src/gitlab/GitLabIntegration.ts b/packages/integration/src/gitlab/GitLabIntegration.ts index d76fd0e0cb..31b9bb1578 100644 --- a/packages/integration/src/gitlab/GitLabIntegration.ts +++ b/packages/integration/src/gitlab/GitLabIntegration.ts @@ -130,8 +130,8 @@ export class GitLabIntegration implements ScmIntegration { // Out of attempts: surface the response or rethrow the captured error if (attempt++ >= maxRetries) { - if (error) throw error; - return response!; + if (response) return response; + throw error; } // Determine delay from Retry-After header if present, otherwise exponential backoff