Skip to content

Commit e2e89d0

Browse files
committed
Refactor error handling in createBearerToken function to throw exceptions instead of warnings
1 parent 86c05a2 commit e2e89d0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pwsh/module/build/AzAPICallBeta/functions/AzAPICallFunctions.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,23 +1608,23 @@ function createBearerToken {
16081608
}
16091609
catch {
16101610
Write-Warning 'dfc4ced5-695b-4b6f-8ec9-464c1d886322'
1611-
Write-Warning $_
1611+
Throw $_
16121612
}
16131613

16141614
try {
16151615
$createdBearerToken = ([Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.AuthenticationFactory.Authenticate($azContext.Account, $azContext.Environment, $azContext.Tenant.id.ToString(), $null, [Microsoft.Azure.Commands.Common.Authentication.ShowDialog]::Never, $null, "$tokenRequestEndPoint")).AccessToken
16161616
}
16171617
catch {
16181618
Write-Warning '724378c1-37ef-42e2-9a84-16581ee48cf6'
1619-
Write-Warning $_
1619+
Throw $_
16201620
}
16211621

16221622
try {
16231623
setBearerAccessToken -createdBearerToken $createdBearerToken -targetEndPoint $targetEndPoint -AzAPICallConfiguration $AzAPICallConfiguration
16241624
}
16251625
catch {
16261626
Write-Warning '37bd83b0-0b72-4cd5-ba59-d7b77d2a5d94'
1627-
Write-Warning $_
1627+
Throw $_
16281628
}
16291629
}
16301630
}

0 commit comments

Comments
 (0)