# frozen_string_literal: true module BusinessFlow # Fire ActiveSupport events for every step that's run and on errors class InstrumentedExecutor < DefaultStepExecutor def call f_class = flow.class f_class.instrument('flow', flow) do |payload| super notify_errors(f_class.event_name, payload) end end protected def notify_errors(name, payload) return unless flow.errors? ActiveSupport::Notifications.publish("#{name}.error", payload) end end end