@@ -214,6 +214,12 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
214214 Write-Verbose - Message " ReportServer not yet accessible (attempt $attempt of $maxRetries ). Waiting $retryIntervalSeconds seconds..." - Verbose
215215 Start-Sleep - Seconds $retryIntervalSeconds
216216 }
217+ elseif ($webRequestStatusCode -eq 0 -and $attempt -eq $maxRetries )
218+ {
219+ # On the last attempt with status code 0, re-throw to get error details
220+ Write-Verbose - Message " ReportServer still not accessible after $maxRetries attempts. Re-throwing exception for diagnostics." - Verbose
221+ throw $_
222+ }
217223 elseif ($webRequestStatusCode -ne 0 )
218224 {
219225 # If we got an actual HTTP error code, break and let the assertion handle it
@@ -270,6 +276,12 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
270276 Write-Verbose - Message " Reports site not yet accessible (attempt $attempt of $maxRetries ). Waiting $retryIntervalSeconds seconds..." - Verbose
271277 Start-Sleep - Seconds $retryIntervalSeconds
272278 }
279+ elseif ($webRequestStatusCode -eq 0 -and $attempt -eq $maxRetries )
280+ {
281+ # On the last attempt with status code 0, re-throw to get error details
282+ Write-Verbose - Message " Reports site still not accessible after $maxRetries attempts. Re-throwing exception for diagnostics." - Verbose
283+ throw $_
284+ }
273285 elseif ($webRequestStatusCode -ne 0 )
274286 {
275287 # If we got an actual HTTP error code, break and let the assertion handle it
@@ -446,6 +458,12 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
446458 Write-Verbose - Message " ReportServer not yet accessible (attempt $attempt of $maxRetries ). Waiting $retryIntervalSeconds seconds..." - Verbose
447459 Start-Sleep - Seconds $retryIntervalSeconds
448460 }
461+ elseif ($webRequestStatusCode -eq 0 -and $attempt -eq $maxRetries )
462+ {
463+ # On the last attempt with status code 0, re-throw to get error details
464+ Write-Verbose - Message " ReportServer still not accessible after $maxRetries attempts. Re-throwing exception for diagnostics." - Verbose
465+ throw $_
466+ }
449467 elseif ($webRequestStatusCode -ne 0 )
450468 {
451469 # If we got an actual HTTP error code, break and let the assertion handle it
@@ -502,6 +520,12 @@ Describe "$($script:dscResourceName)_Integration" -Tag @('Integration_SQL2016',
502520 Write-Verbose - Message " Reports site not yet accessible (attempt $attempt of $maxRetries ). Waiting $retryIntervalSeconds seconds..." - Verbose
503521 Start-Sleep - Seconds $retryIntervalSeconds
504522 }
523+ elseif ($webRequestStatusCode -eq 0 -and $attempt -eq $maxRetries )
524+ {
525+ # On the last attempt with status code 0, re-throw to get error details
526+ Write-Verbose - Message " Reports site still not accessible after $maxRetries attempts. Re-throwing exception for diagnostics." - Verbose
527+ throw $_
528+ }
505529 elseif ($webRequestStatusCode -ne 0 )
506530 {
507531 # If we got an actual HTTP error code, break and let the assertion handle it
0 commit comments