Skip to content

Commit ce88a55

Browse files
authored
Fix error handling regression (#71)
* Remove unnecessary code * fix error handling regression
1 parent a3ecdcf commit ce88a55

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/internal/Get-MsGraphResults.ps1

+2-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function Get-MsGraphResults {
133133
else {
134134
## Ignore errors with specific codes else display non-terminating error
135135
if ($ResponseDetail['ContentParsed'].error.code -eq 'Request_ResourceNotFound') {
136-
#Write-Error -Exception $_.Exception -Message $ResponseDetail['ContentParsed'].error.message -ErrorId $ResponseDetail['ContentParsed'].error.code -Category $_.CategoryInfo.Category -CategoryActivity $_.CategoryInfo.Activity -CategoryReason $_.CategoryInfo.Reason -CategoryTargetName $_.CategoryInfo.TargetName -CategoryTargetType $_.CategoryInfo.TargetType -TargetObject $_.TargetObject -ErrorVariable cmdError -ErrorAction SilentlyContinue
136+
Write-Error -Exception $_.Exception -Message $ResponseDetail['ContentParsed'].error.message -ErrorId $ResponseDetail['ContentParsed'].error.code -Category $_.CategoryInfo.Category -CategoryActivity $_.CategoryInfo.Activity -CategoryReason $_.CategoryInfo.Reason -CategoryTargetName $_.CategoryInfo.TargetName -CategoryTargetType $_.CategoryInfo.TargetType -TargetObject $_.TargetObject -ErrorVariable cmdError -ErrorAction SilentlyContinue
137137
#Write-Warning $ResponseDetail['ContentParsed'].error.message
138138
}
139139
else {
@@ -158,7 +158,7 @@ function Get-MsGraphResults {
158158
else {
159159
## Ignore errors with specific codes else display non-terminating error
160160
if ($BatchResponse.body.error.code -eq 'Request_ResourceNotFound') {
161-
#Write-Error -Message $BatchResponse.body.error.message -ErrorId $BatchResponse.body.error.code -ErrorVariable cmdError -ErrorAction SilentlyContinue
161+
Write-Error -Message $BatchResponse.body.error.message -ErrorId $BatchResponse.body.error.code -ErrorVariable cmdError -ErrorAction SilentlyContinue
162162
#Write-Warning $BatchResponse.body.error.message
163163
}
164164
else {
@@ -444,7 +444,6 @@ function Get-MsGraphResults {
444444
$Activity = ('{0} {1}' -f $Request.method.ToUpper(), $uriEndpoint.AbsolutePath)
445445
$ProgressState = Start-Progress -Activity $Activity -Total $Total
446446
$ProgressState.CurrentIteration = $Result.value.Count
447-
$MaxRetries = 5
448447
try {
449448
while (Get-ObjectPropertyValue $Result '@odata.nextLink') {
450449
Update-Progress $ProgressState -IncrementBy $Result.value.Count

0 commit comments

Comments
 (0)