Skip to content

Commit c0ceb19

Browse files
committed
Update Get-AADGroupByDisplayName (Error Handling)
* Fix error message * Incuding original exception with error message
1 parent 340eb51 commit c0ceb19

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PSMSGraph/Public/Get-AADGroupByDisplayName.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ function Get-AADGroupByDisplayName {
101101
$Result = Invoke-GraphRequest @Params
102102
}
103103
catch {
104-
$ErrorMessage = "Unable to query User '{0}': {1}" -f $UserId, $_.Exception.Message
105-
Write-Error $ErrorMessage
104+
$ErrorMessage = "Unable to query Group '{0}': {1}" -f $GroupName, $_.Exception.Message
105+
Write-Error -Message $ErrorMessage -Exception $_.Exception
106106
return
107107
}
108108
foreach ($ServiceObject in $Result.ContentObject.value) {

0 commit comments

Comments
 (0)