Merge pull request #5769 from mitchellh/pr-4711

Pr 4711
This commit is contained in:
Seth Vargo 2015-05-31 18:39:07 -07:00
commit 9cf362292f
3 changed files with 23 additions and 1 deletions

View File

@ -209,9 +209,16 @@ module Vagrant
@logger.error("Vagrantfile load error: #{e.message}")
@logger.error(e.backtrace.join("\n"))
line = "(unknown)"
if e.backtrace && e.backtrace[0]
line = e.backtrace[0].split(":")[1]
end
# Report the generic exception
raise Errors::VagrantfileLoadError,
path: path,
line: line,
exception_class: e.class,
message: e.message
end
end

View File

@ -37,6 +37,8 @@ module VagrantPlugins
attr_reader :provisioners
def initialize
@logger = Log4r::Logger.new("vagrant::config::vm")
@base_mac = UNSET_VALUE
@boot_timeout = UNSET_VALUE
@box = UNSET_VALUE
@ -446,8 +448,20 @@ module VagrantPlugins
config = config.merge(new_config)
end
rescue Exception => e
@logger.error("Vagrantfile load error: #{e.message}")
@logger.error(e.inspect)
@logger.error(e.message)
@logger.error(e.backtrace.join("\n"))
line = "(unknown)"
if e.backtrace && e.backtrace[0]
line = e.backtrace[0].split(":")[1]
end
raise Vagrant::Errors::VagrantfileLoadError,
path: "<provider config: #{name}>",
line: line,
exception_class: e.class,
message: e.message
end

View File

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