diff options
author | John McCrae <john.mccrae@progress.com> | 2022-10-30 09:37:54 +0600 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2022-10-30 09:37:54 +0600 |
commit | 493a68e19487aefc72096bf9ecd00ed21d5f5782 (patch) | |
tree | bb464b2e543501d9cf0dee08d65ebcfe52484e09 | |
parent | 4647f984862d1fbd44625d459789ab33b95fdadb (diff) | |
download | chef-493a68e19487aefc72096bf9ecd00ed21d5f5782.tar.gz |
Adding a Catch block to the Try/Catch/Finally
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r-- | habitat/plan.ps1 | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1 index fc5cb576bc..759a828596 100644 --- a/habitat/plan.ps1 +++ b/habitat/plan.ps1 @@ -58,11 +58,17 @@ function Invoke-Download() { Write-Output "Hab source path is : ${HAB_CACHE_SRC_PATH}`n" Write-Output "Package Filename is : ${pkg_filename}" # [System.Diagnostics.Process]::Start("git archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD") + Write-Output "Now archiving the repo" Invoke-Expression -Command "$full_git_path archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD --verbose" + Write-Output "Zipping the Repo is finished" Start-Sleep -Seconds 30 Write-Output " *** Finished Creating the Archive *** `n" # getting an error about the archive being in use, adding the sleep to let other handles on the file finish. if (-not $?) { throw "unable to create archive of source" } + catch{ + Write-Output "Plan.ps1 threw an error in Invoke-Download - An error occurred:" + Write-Output $_ + } } finally { Write-Output " *** Executing Pop-Location *** " Pop-Location |