Sha256: dfae7c4d103cd8692cfd67c155c18fb41a357f4e721a42b98755289f0c5b49ec

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
business_flow-0.19.6 lib/business_flow/instrumented_executor.rb