Skip to content

Commit 35ed2fb

Browse files
committed
Fix parse error and empty catch block in Invoke-HttpRequestWithRetry
- Delimit variable name with braces (\:) to prevent PowerShell parsing it as a drive-qualified variable reference - Replace empty catch block with Write-Verbose to satisfy PSScriptAnalyzer
1 parent e0dfbc4 commit 35ed2fb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ALZ/Private/Shared/Invoke-HttpRequestWithRetry.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function Invoke-HttpRequestWithRetry {
168168

169169
$isTransient = $responseCode -in $transientStatusCodes
170170

171-
Write-Verbose "HTTP $Method $Uri - Error on attempt $attempt: Status=$responseCode, Message=$($_.Exception.Message)"
171+
Write-Verbose "HTTP $Method $Uri - Error on attempt ${attempt}: Status=$responseCode, Message=$($_.Exception.Message)"
172172

173173
if ($isTransient -and $attempt -lt $maxAttempts) {
174174
Write-ToConsoleLog "Request to $Uri failed with status $responseCode (attempt $attempt of $maxAttempts). Retrying in $RetryIntervalSeconds seconds..." -IsWarning
@@ -191,7 +191,7 @@ function Invoke-HttpRequestWithRetry {
191191
}
192192
}
193193
} catch {
194-
# Ignore errors reading response body
194+
Write-Verbose "Failed to read response body: $($_.Exception.Message)"
195195
}
196196
}
197197
Write-ToConsoleLog $errorDetails -IsError

0 commit comments

Comments
 (0)