drop non-null assertion in retry loop

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) <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-05-04 11:17:51 +02:00
parent 90d3968e6c
commit d7f994308e
@@ -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