Skip to content

Commit b593a27

Browse files
author
Friedrich Weinmann
committed
Updated error handling on import
1 parent 67613a2 commit b593a27

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

PSFramework/PSFramework.psm1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ function Import-ModuleFile
5353
$Path
5454
)
5555

56-
if ($doDotSource) { . (Resolve-Path $Path) }
57-
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path $Path).ProviderPath))), $null, $null) }
56+
try
57+
{
58+
if ($doDotSource) { . (Resolve-Path $Path) }
59+
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText((Resolve-Path $Path).ProviderPath))), $null, $null) }
60+
}
61+
catch { throw (New-Object System.Exception("Failed to import $(Resolve-Path $Path) _ $_", $_.Exception)) }
5862
}
5963

6064
#region Load individual files

0 commit comments

Comments
 (0)