Skip to content

Commit

Permalink
added error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
SQLDBAWithABeard committed Aug 28, 2018
1 parent 4a2f639 commit 8954cbf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dbachecks.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ function Import-ModuleFile {
)

if ($doDotSource) { . $Path }
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null) }
else {
try {
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null)
}
catch {
Write-Warning "Failed to import $Path"
}
}
}

# Detect whether at some level dotsourcing was enforced
Expand Down

0 comments on commit 8954cbf

Please sign in to comment.