Warden properly handles interrupts
This commit is contained in:
parent
71101c9d3d
commit
0094f066ca
|
@ -20,6 +20,7 @@ module Vagrant
|
|||
begin
|
||||
# Call the next middleware in the sequence, appending to the stack
|
||||
# of "recoverable" middlewares in case something goes wrong!
|
||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||
@stack.unshift(@actions.shift).first.call(env)
|
||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||
rescue
|
||||
|
@ -34,6 +35,10 @@ module Vagrant
|
|||
@stack.each do |act|
|
||||
act.recover(env) if act.respond_to?(:recover)
|
||||
end
|
||||
|
||||
# Clear stack so that warden down the middleware chain doesn't
|
||||
# rescue again.
|
||||
@stack.clear
|
||||
end
|
||||
|
||||
def finalize_action(action, env)
|
||||
|
|
|
@ -32,7 +32,7 @@ module Vagrant
|
|||
def initialize(message=nil, *args)
|
||||
message = { :_key => message } if message && !message.is_a?(Hash)
|
||||
message = { :_key => error_key, :_namespace => error_namespace }.merge(message || {})
|
||||
message = translate_error(message) if message[:_key]
|
||||
message = translate_error(message)
|
||||
|
||||
super
|
||||
end
|
||||
|
@ -49,6 +49,7 @@ module Vagrant
|
|||
protected
|
||||
|
||||
def translate_error(opts)
|
||||
return nil if !opts[:_key]
|
||||
I18n.t("#{opts[:_namespace]}.#{opts[:_key]}", opts)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue