Skip to content

Commit

Permalink
(chocolateyGH-91) Terminating errors - choco upgrade fail
Browse files Browse the repository at this point in the history
Further refine where actions should be terminating so try catch can
notify user of possible manual actions to take.
  • Loading branch information
ferventcoder committed Feb 12, 2015
1 parent 27deb5b commit 810efb4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nuget/chocolatey/tools/chocolateysetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $chocInstallVariableName = "ChocolateyInstall"
$sysDrive = $env:SystemDrive
$tempDir = $env:TEMP
$defaultChocolateyPathOld = "$sysDrive\Chocolatey"
$ErrorActionPreference = 'Stop'
#$ErrorActionPreference = 'Stop'
$debugMode = $false

function Initialize-Chocolatey {
Expand Down Expand Up @@ -173,7 +173,7 @@ param(
Copy-Item "$chocolateyPathOld\lib\*" "$chocolateyPath\lib" -force -recurse
try {
Write-Output "Attempting to remove `'$chocolateyPathOld`'. This may fail if something in the folder is being used or locked."
Remove-Item "$($chocolateyPathOld)" -force -recurse
Remove-Item "$($chocolateyPathOld)" -force -recurse -ErrorAction Stop
}
catch {
Write-Warning "Was not able to remove `'$chocolateyPathOld`'. You will need to manually remove it."
Expand Down Expand Up @@ -262,7 +262,7 @@ param(
if (Test-Path ($binFilePathRename)) {
try {
Write-Debug "Attempting to remove $binFilePathRename"
Remove-Item $binFilePathRename -force
Remove-Item $binFilePathRename -force -ErrorAction Stop
}
catch {
Write-Warning "Was not able to remove `'$binFilePathRename`'. This may cause errors."
Expand All @@ -271,7 +271,7 @@ param(
if (Test-Path ($binFilePath)) {
try {
Write-Debug "Attempting to rename $binFilePath to $binFilePathRename"
Move-Item -path $binFilePath -destination $binFilePathRename -force
Move-Item -path $binFilePath -destination $binFilePathRename -force -ErrorAction Stop
}
catch {
Write-Warning "Was not able to rename `'$binFilePath`' to `'$binFilePathRename`'."
Expand All @@ -280,7 +280,7 @@ param(

try {
Write-Debug "Attempting to copy $exeFilePath to $binFilePath"
Copy-Item -path $exeFilePath -destination $binFilePath -force
Copy-Item -path $exeFilePath -destination $binFilePath -force -ErrorAction Stop
}
catch {
Write-Warning "Was not able to replace `'$binFilePath`' with `'$exeFilePath`'. You may need to do this manually."
Expand Down

0 comments on commit 810efb4

Please sign in to comment.