Skip to content

Commit

Permalink
Fix error handling regression (#71)
Browse files Browse the repository at this point in the history
* Remove unnecessary code

* fix error handling regression
  • Loading branch information
jazuntee authored Sep 12, 2022
1 parent a3ecdcf commit ce88a55
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/internal/Get-MsGraphResults.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function Get-MsGraphResults {
else {
## Ignore errors with specific codes else display non-terminating error
if ($ResponseDetail['ContentParsed'].error.code -eq 'Request_ResourceNotFound') {
#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
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
#Write-Warning $ResponseDetail['ContentParsed'].error.message
}
else {
Expand All @@ -158,7 +158,7 @@ function Get-MsGraphResults {
else {
## Ignore errors with specific codes else display non-terminating error
if ($BatchResponse.body.error.code -eq 'Request_ResourceNotFound') {
#Write-Error -Message $BatchResponse.body.error.message -ErrorId $BatchResponse.body.error.code -ErrorVariable cmdError -ErrorAction SilentlyContinue
Write-Error -Message $BatchResponse.body.error.message -ErrorId $BatchResponse.body.error.code -ErrorVariable cmdError -ErrorAction SilentlyContinue
#Write-Warning $BatchResponse.body.error.message
}
else {
Expand Down Expand Up @@ -444,7 +444,6 @@ function Get-MsGraphResults {
$Activity = ('{0} {1}' -f $Request.method.ToUpper(), $uriEndpoint.AbsolutePath)
$ProgressState = Start-Progress -Activity $Activity -Total $Total
$ProgressState.CurrentIteration = $Result.value.Count
$MaxRetries = 5
try {
while (Get-ObjectPropertyValue $Result '@odata.nextLink') {
Update-Progress $ProgressState -IncrementBy $Result.value.Count
Expand Down

0 comments on commit ce88a55

Please sign in to comment.