Skip to content

Commit 45cf1b5

Browse files
Catch error in trap
1 parent b050f5f commit 45cf1b5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/dsc/psresourceget.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,14 @@ function ConvertInputToPSResource(
269269

270270
# catch any un-caught exception and write it to the error stream
271271
trap {
272-
Write-Trace -Level Error -message $_.Exception.Message
272+
273+
if ($_.Exception.GetType().FullName -eq 'System.IO.FileLoadException') {
274+
Write-Trace -message "NuGet.Versioning assembly is already loaded. Continuing with existing assembly, as all the versions have the functionality available." -level trace
275+
}
276+
else {
277+
Write-Trace -Level Error -message $_.Exception.Message
278+
}
279+
273280
exit 1
274281
}
275282

0 commit comments

Comments
 (0)