Skip to content

Commit

Permalink
Improve output in error
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Feb 19, 2024
1 parent d62b231 commit c0c1f25
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Private/New-DLLCodeOutput.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
" } catch {"
if ($HandleAssemblyWithSameName) {
" if (`$_.Exception.Message -like '*Assembly with same name is already loaded*') {"
" Write-Warning -Message `"Assembly with same name is already loaded. Ignoring '`$(`$_.InvocationInfo.Statement)'.`""
" Write-Warning -Message `"Assembly with same name is already loaded. Ignoring '`$L'.`""
" } else {"
" Write-Warning `"Processing `$(`$ImportName) Exception: `$(`$_.Exception.Message)`"",
" `$LoaderExceptions = `$(`$_.Exception.LoaderExceptions) | Sort-Object -Unique",
Expand Down Expand Up @@ -61,12 +61,11 @@
}
")"
"foreach (`$L in `$LibrariesToLoad) {"

' try {'
' Add-Type -Path $PSScriptRoot\$L -ErrorAction Stop'
' } catch {'
" if (`$_.Exception.Message -like '*Assembly with same name is already loaded*') {"
" Write-Warning -Message `"Assembly with same name is already loaded. Ignoring '`$(`$_.InvocationInfo.Statement)'.`""
" Write-Warning -Message `"Assembly with same name is already loaded. Ignoring '`$L'.`""
' } else {'
' throw $_'
' }'
Expand Down

0 comments on commit c0c1f25

Please sign in to comment.