From b9e701f853e250f0f68df7a84c8a9b5e32e81b00 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 8 Jan 2014 20:04:48 -0800 Subject: [PATCH] catch errors that happen before Vagrant is even loaded --- bin/vagrant | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/vagrant b/bin/vagrant index 4f854235f..5c2af1234 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -137,7 +137,12 @@ begin # Exit with the exit status from our CLI command exit(exit_status) -rescue Vagrant::Errors::VagrantError => e +rescue Exception => e + # It is possible for errors to happen in Vagrant's initialization. In + # this case, we don't have access to this class yet, so we check for it. + raise if !defined?(Vagrant) || !defined?(Vagrant::Errors) + raise if !e.is_a?(Vagrant::Errors::VagrantError) + require 'log4r' logger = Log4r::Logger.new("vagrant::bin::vagrant") logger.error("Vagrant experienced an error! Details:")