Skip to content

Commit

Permalink
#212 Remove superfluous try/catch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
dtgm committed Jun 6, 2016
1 parent 37ea402 commit 108dd10
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
18 changes: 7 additions & 11 deletions automatic/i2p/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
15 changes: 6 additions & 9 deletions automatic/izpack/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Start-Process $ahkExe $ahkRun
Start-ChocolateyProcessAsAdmin -Statements "$installArgs" `
-ExeToRun "powershell" `
-ValidExitCodes $validExitCodes
Remove-Item "$ahkRun" -Force
13 changes: 4 additions & 9 deletions automatic/netbeans/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ function Get-UninstallString {
}
}

try {
$packageName = '{{PackageName}}'
$uninstallArgs = '--silent'
$validExitCodes = @(0)
Start-ChocolateyProcessAsAdmin $uninstallArgs $(Get-UninstallString) -validExitCodes $validExitCodes
}
catch {
throw $_.Exception
}
$packageName = '{{PackageName}}'
$uninstallArgs = '--silent'
$validExitCodes = @(0)
Start-ChocolateyProcessAsAdmin $uninstallArgs $(Get-UninstallString) -validExitCodes $validExitCodes

0 comments on commit 108dd10

Please sign in to comment.