catch errors that happen before Vagrant is even loaded

This commit is contained in:
Mitchell Hashimoto 2014-01-08 20:04:48 -08:00
parent 7631a38601
commit b9e701f853
1 changed files with 6 additions and 1 deletions

View File

@ -137,7 +137,12 @@ begin
# Exit with the exit status from our CLI command # Exit with the exit status from our CLI command
exit(exit_status) 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' require 'log4r'
logger = Log4r::Logger.new("vagrant::bin::vagrant") logger = Log4r::Logger.new("vagrant::bin::vagrant")
logger.error("Vagrant experienced an error! Details:") logger.error("Vagrant experienced an error! Details:")