Always log the exception raised when error loading a plugin
This commit is contained in:
parent
1b6538354d
commit
29600d3d06
|
@ -170,6 +170,14 @@ module Vagrant
|
||||||
begin
|
begin
|
||||||
require name
|
require name
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
# Since this is a rare case, we create a one-time logger here
|
||||||
|
# in order to output the error
|
||||||
|
logger = Log4r::Logger.new("vagrant::root")
|
||||||
|
logger.error("Failed to load plugin: #{name}")
|
||||||
|
logger.error(" -- Error: #{e.inspect}")
|
||||||
|
logger.error(" -- Backtrace:")
|
||||||
|
logger.error(e.backtrace.join("\n"))
|
||||||
|
|
||||||
# If it is a LoadError we first try to see if it failed loading
|
# If it is a LoadError we first try to see if it failed loading
|
||||||
# the top-level entrypoint. If so, then we report a different error.
|
# the top-level entrypoint. If so, then we report a different error.
|
||||||
if e.is_a?(LoadError)
|
if e.is_a?(LoadError)
|
||||||
|
@ -181,14 +189,6 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Since this is a rare case, we create a one-time logger here
|
|
||||||
# in order to output the error
|
|
||||||
logger = Log4r::Logger.new("vagrant::root")
|
|
||||||
logger.error("Failed to load plugin: #{name}")
|
|
||||||
logger.error(" -- Error: #{e.inspect}")
|
|
||||||
logger.error(" -- Backtrace:")
|
|
||||||
logger.error(e.backtrace.join("\n"))
|
|
||||||
|
|
||||||
# And raise an error itself
|
# And raise an error itself
|
||||||
raise Errors::PluginLoadFailed, :plugin => name
|
raise Errors::PluginLoadFailed, :plugin => name
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue