Skip to content

Commit f9760f1

Browse files
committed
Added try catch
1 parent 75a556d commit f9760f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scripts/MsProdUpdate.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function Get-ExternalDocsUrl {
119119
[string] $File = (Join-Path $PSScriptRoot "../microsoftgraph/graph-powershell-1.0/Microsoft.Graph.Users/Get-MgUser.md"),
120120
[string] $Module = "Users"
121121
)
122+
try {
122123
if ($UriPath) {
123124

124125
if ($OpenApiContent.openapi && $OpenApiContent.info.version) {
@@ -193,6 +194,13 @@ function Get-ExternalDocsUrl {
193194

194195
}
195196
}
197+
} catch {
198+
199+
Write-Host "`nError Message: " $_.Exception.Message
200+
Write-Host "`nError in Line: " $_.InvocationInfo.Line
201+
Write-Host "`nError in Line Number: "$_.InvocationInfo.ScriptLineNumber
202+
Write-Host "`nError Item Name: "$_.Exception.ItemName
203+
}
196204
}
197205
function Append-GraphPrefix {
198206
param(

0 commit comments

Comments
 (0)