diff --git a/plugins/commands/ps/command.rb b/plugins/commands/ps/command.rb index ee021d0ed..63963491a 100644 --- a/plugins/commands/ps/command.rb +++ b/plugins/commands/ps/command.rb @@ -91,7 +91,7 @@ module VagrantPlugins args << "-password" << ps_info[:password] result = Vagrant::Util::PowerShell.execute(script_path, *args) if result.exit_code != 0 - raise Errors::PowershellError, + raise Errors::PowerShellError, script: script_path, stderr: result.stderr end @@ -108,7 +108,7 @@ module VagrantPlugins args << "-hostname" << ps_info[:host] result = Vagrant::Util::PowerShell.execute(script_path, *args) if result.exit_code != 0 - raise Errors::PowershellError, + raise Errors::PowerShellError, script: script_path, stderr: result.stderr end diff --git a/plugins/commands/ps/errors.rb b/plugins/commands/ps/errors.rb index c614fb87a..4be70551a 100644 --- a/plugins/commands/ps/errors.rb +++ b/plugins/commands/ps/errors.rb @@ -2,17 +2,21 @@ module VagrantPlugins module CommandPS module Errors # A convenient superclass for all our errors. - class PSError < Vagrant::Errors::VagrantError + class PSCommandError < Vagrant::Errors::VagrantError error_namespace("vagrant_ps.errors") end - class HostUnsupported < PSError + class HostUnsupported < PSCommandError error_key(:host_unsupported) end - class PSRemotingUndetected < PSError + class PSRemotingUndetected < PSCommandError error_key(:ps_remoting_undetected) end + + class PowerShellError < PSCommandError + error_key(:powershell_error) + end end end end diff --git a/templates/locales/command_ps.yml b/templates/locales/command_ps.yml index 51bf666cc..179aae842 100644 --- a/templates/locales/command_ps.yml +++ b/templates/locales/command_ps.yml @@ -3,7 +3,7 @@ en: detecting: |- Detecting if a remote PowerShell connection can be made with the guest... reseting: |- - Reseting WinRM TrustedHosts to their original value. + Resetting WinRM TrustedHosts to their original value. errors: host_unsupported: |- @@ -14,3 +14,14 @@ en: Unable to establish a remote PowerShell connection with the guest. Check if the firewall rules on the guest allow connections to the Windows remote management service. + + powershell_error: |- + An error occurred while executing a PowerShell script. This error + is shown below. Please read the error message and see if this is + a configuration error with your system. If it is not, then please + report a bug. + + Script: %{script} + Error: + + %{stderr}