From fd2878309b71614c3d0d397d73361b79b359f297 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Thu, 29 Mar 2018 15:52:46 -0700 Subject: [PATCH] Move exception warnings in run function --- lib/vagrant/plugin/v2/trigger.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/plugin/v2/trigger.rb b/lib/vagrant/plugin/v2/trigger.rb index 17c0469c9..1eb407a94 100644 --- a/lib/vagrant/plugin/v2/trigger.rb +++ b/lib/vagrant/plugin/v2/trigger.rb @@ -170,16 +170,17 @@ module Vagrant @machine.ui.error(data) end end - rescue Exception => e + # TODO: I18n me and write better message + @machine.ui.error("Trigger run failed:") + @machine.ui.error(e.message) + if on_error == :halt @logger.debug("Trigger run encountered an error. Halting on error...") + # Raise proper Vagrant error to avoid ugly stacktrace raise e else @logger.debug("Trigger run encountered an error. Continuing on anyway...") - # TODO: I18n me and write better message - @machine.ui.error("Trigger run failed:") - @machine.ui.error(e.message) end end end