Add error message for errors originating from a remote

This commit is contained in:
sophia 2022-05-13 17:14:46 -05:00
parent 26fac3e1d9
commit d708bab84a
3 changed files with 18 additions and 3 deletions

View File

@ -928,6 +928,10 @@ module Vagrant
error_key(:vagrantfile_name_error)
end
class VagrantRemoteError < VagrantError
error_key(:vagrant_remote_error)
end
class VagrantfileSyntaxError < VagrantError
error_key(:vagrantfile_syntax_error)
end

View File

@ -18,8 +18,12 @@ module VagrantPlugins
"TerminalUI"
end
def is_interactive
client.is_interactive.interactive
end
def input(prompt, **opts)
client.events(
event_resp = client.events(
[
SDK::TerminalUI::Event.new(
input: SDK::TerminalUI::Event::Input.new(
@ -29,8 +33,13 @@ module VagrantPlugins
)
),
].each
).map { |resp|
resp.input.input
)
event_resp.map { |resp|
input = resp.input
if !input.error.nil?
raise Vagrant::Errors::VagrantRemoteError, msg: input.error.message
end
input.input
}.first
end

View File

@ -1672,6 +1672,8 @@ en:
Path: %{path}
Line number: %{line}
Message: %{message}
vagrant_remote_error: |-
%{msg}
vagrantfile_syntax_error: |-
There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience: