From dd918401f8f1e75315e714c1359c62ec66a2bb9d Mon Sep 17 00:00:00 2001 From: Corwin Brown Date: Mon, 2 Nov 2015 14:08:00 -0600 Subject: [PATCH] Added Error messages to the Try/Catch blocks --- lib/ansible/modules/extras/windows/win_unzip.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/windows/win_unzip.ps1 b/lib/ansible/modules/extras/windows/win_unzip.ps1 index ed90dce365..0e5485dddb 100644 --- a/lib/ansible/modules/extras/windows/win_unzip.ps1 +++ b/lib/ansible/modules/extras/windows/win_unzip.ps1 @@ -19,6 +19,7 @@ # WANT_JSON # POWERSHELL_COMMON + $params = Parse-Args $args; $result = New-Object psobject @{ @@ -47,7 +48,8 @@ If (-Not (Test-Path $dest -PathType Container)){ New-Item -itemtype directory -path $dest } Catch { - Fail-Json $result "Error creating $dest directory" + $err_msg = $_.Exception.Message + Fail-Json $result "Error creating $dest directory! Msg: $err_msg" } } @@ -63,7 +65,8 @@ If ($ext -eq ".zip" -And $recurse -eq $false) { $result.changed = $true } Catch { - Fail-Json $result "Error unzipping $src to $dest" + $err_msg = $_.Exception.Message + Fail-Json $result "Error unzipping $src to $dest! Msg: $err_msg" } } # Requires PSCX @@ -107,11 +110,12 @@ Else { } } Catch { + $err_msg = $_.Exception.Message If ($recurse) { - Fail-Json $result "Error recursively expanding $src to $dest" + Fail-Json $result "Error recursively expanding $src to $dest! Msg: $err_msg" } Else { - Fail-Json $result "Error expanding $src to $dest" + Fail-Json $result "Error expanding $src to $dest! Msg: $err_msg" } } }