Make powershell error generalized

This commit is contained in:
Chris Roberts 2017-12-21 08:06:51 -08:00
parent f330f81fbf
commit 81cbdae62a
3 changed files with 5 additions and 11 deletions

View File

@ -552,6 +552,10 @@ module Vagrant
error_key(:powershell_invalid_version) error_key(:powershell_invalid_version)
end end
class PowerShellError < VagrantError
error_key(:powershell_error, "vagrant_ps.errors.powershell_error")
end
class ProviderCantInstall < VagrantError class ProviderCantInstall < VagrantError
error_key(:provider_cant_install) error_key(:provider_cant_install)
end end

View File

@ -15,7 +15,7 @@ module VagrantPlugins
script_path = File.expand_path("../../scripts/host_info.ps1", __FILE__) script_path = File.expand_path("../../scripts/host_info.ps1", __FILE__)
r = Vagrant::Util::PowerShell.execute(script_path) r = Vagrant::Util::PowerShell.execute(script_path)
if r.exit_code != 0 if r.exit_code != 0
raise Errors::PowershellError, raise Vagrant::Errors::PowerShellError,
script: script_path, script: script_path,
stderr: r.stderr stderr: r.stderr
end end

View File

@ -49,16 +49,6 @@ en:
As another option, you can manually specify an IP for the machine As another option, you can manually specify an IP for the machine
to mount from using the `smb_host` option to the synced folder. to mount from using the `smb_host` option to the synced folder.
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}
powershell_version: |- powershell_version: |-
PowerShell version 3 or later is required for SMB synced folders PowerShell version 3 or later is required for SMB synced folders
to work on Windows. You have version: '%{version}'. Please update to work on Windows. You have version: '%{version}'. Please update