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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user