lib/mikoshi/plan/task_definition.rb in mikoshi-0.2.1 vs lib/mikoshi/plan/task_definition.rb in mikoshi-0.3.0
- old
+ new
@@ -16,17 +16,23 @@
ENV['TASK_DEF_REVISION'] = resp.task_definition.revision.to_s
invoke_after_register_hooks
resp
+ rescue => e
+ invoke_failed_hooks
+ raise e
end
private
%w[before after].each do |step|
define_method "invoke_#{step}_register_hooks" do
invoke_hooks @data[:hooks]["#{step}_register".to_sym] unless @data.dig(:hooks, "#{step}_register".to_sym).nil?
end
+ end
+ def invoke_failed_hooks
+ invoke_hooks(@data[:hooks][:failed]) unless @data.dig(:hooks, :failed).nil?
end
end
end
end