From 108dd10b5735a188760d33cb11b6b139ad7e469f Mon Sep 17 00:00:00 2001 From: dtgm Date: Mon, 6 Jun 2016 16:10:09 -0600 Subject: [PATCH] #212 Remove superfluous try/catch statements --- automatic/i2p/tools/chocolateyUninstall.ps1 | 18 +++++++----------- automatic/izpack/tools/chocolateyUninstall.ps1 | 15 ++++++--------- .../netbeans/tools/chocolateyUninstall.ps1 | 13 ++++--------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/automatic/i2p/tools/chocolateyUninstall.ps1 b/automatic/i2p/tools/chocolateyUninstall.ps1 index aefa7a0f9a..af83130870 100644 --- a/automatic/i2p/tools/chocolateyUninstall.ps1 +++ b/automatic/i2p/tools/chocolateyUninstall.ps1 @@ -36,15 +36,11 @@ $ahkExe = 'AutoHotKey' $ahkRun = "$Env:Temp\$(Get-Random).ahk" Copy-Item $ahkFile "$ahkRun" -Force -try { - Start-Process $ahkExe $ahkRun - Start-ChocolateyProcessAsAdmin -Statements "$installArgs" ` - -ExeToRun "java" ` - -ValidExitCodes $validExitCodes - Remove-Item "$ahkRun" -Force - if (Test-Path $inPath) { - Remove-Item -Path $inPath -Recurse - } -} catch { - throw +Start-Process $ahkExe $ahkRun +Start-ChocolateyProcessAsAdmin -Statements "$installArgs" ` + -ExeToRun "java" ` + -ValidExitCodes $validExitCodes +Remove-Item "$ahkRun" -Force +if (Test-Path $inPath) { + Remove-Item -Path $inPath -Recurse } \ No newline at end of file diff --git a/automatic/izpack/tools/chocolateyUninstall.ps1 b/automatic/izpack/tools/chocolateyUninstall.ps1 index 12e0aef4be..e7e9678e24 100644 --- a/automatic/izpack/tools/chocolateyUninstall.ps1 +++ b/automatic/izpack/tools/chocolateyUninstall.ps1 @@ -14,12 +14,9 @@ if (Test-Path "${Env:ProgramFiles(x86)}\IzPack\Uninstaller\") { throw } $installArgs = "javaw -jar `'$($unString)`'" -try { - Start-Process $ahkExe $ahkRun - Start-ChocolateyProcessAsAdmin -Statements "$installArgs" ` - -ExeToRun "powershell" ` - -ValidExitCodes $validExitCodes - Remove-Item "$ahkRun" -Force -} catch { - throw -} \ No newline at end of file + +Start-Process $ahkExe $ahkRun +Start-ChocolateyProcessAsAdmin -Statements "$installArgs" ` + -ExeToRun "powershell" ` + -ValidExitCodes $validExitCodes +Remove-Item "$ahkRun" -Force \ No newline at end of file diff --git a/automatic/netbeans/tools/chocolateyUninstall.ps1 b/automatic/netbeans/tools/chocolateyUninstall.ps1 index 31265669dc..ef80de5398 100644 --- a/automatic/netbeans/tools/chocolateyUninstall.ps1 +++ b/automatic/netbeans/tools/chocolateyUninstall.ps1 @@ -11,12 +11,7 @@ function Get-UninstallString { } } -try { - $packageName = '{{PackageName}}' - $uninstallArgs = '--silent' - $validExitCodes = @(0) - Start-ChocolateyProcessAsAdmin $uninstallArgs $(Get-UninstallString) -validExitCodes $validExitCodes -} -catch { - throw $_.Exception -} \ No newline at end of file +$packageName = '{{PackageName}}' +$uninstallArgs = '--silent' +$validExitCodes = @(0) +Start-ChocolateyProcessAsAdmin $uninstallArgs $(Get-UninstallString) -validExitCodes $validExitCodes \ No newline at end of file