Add Another Catch Statement with some 'Write-Warning' for Extra Information

This commit is contained in:
Mr.k
2024-04-30 00:59:17 +03:00
parent 84ac49dec5
commit db638e13bc

View File

@ -25,8 +25,12 @@ function Test-WinUtilPackageManager {
try { try {
$wingetVersionFull = winget --version $wingetVersionFull = winget --version
} catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] { } catch [System.Management.Automation.CommandNotFoundException], [System.Management.Automation.ApplicationFailedException] {
Write-Warning "Winget was not found due to un-availablity reasons"
$wingetExists = $false $wingetExists = $false
} } catch {
Write-Warning "Winget was not found due to un-known reasons, The Stack Trace is:`n$($psitem.Exception.StackTrace)"
$wingetExists = $false
}
# If Winget is available, Parse it's Version and give proper information to Terminal Output. # If Winget is available, Parse it's Version and give proper information to Terminal Output.
# If it isn't available, the return of this funtion will be "not-installed", indicating that # If it isn't available, the return of this funtion will be "not-installed", indicating that