From 29600d3d06d45e9e773148af5bb916bcbf1ad2af Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Feb 2013 15:11:01 -0800 Subject: [PATCH] Always log the exception raised when error loading a plugin --- lib/vagrant.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/vagrant.rb b/lib/vagrant.rb index c505d9e34..697c8030f 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -170,6 +170,14 @@ module Vagrant begin require name 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 # the top-level entrypoint. If so, then we report a different error. if e.is_a?(LoadError) @@ -181,14 +189,6 @@ module Vagrant 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 raise Errors::PluginLoadFailed, :plugin => name end