4

Given an operation like

class MyOperation < Trailblazer::Operation
  step :do_a!
  step :do_b!

  def do_a(options, **)
    false
  end

  def do_b(options, **)
    true
  end
end

and the result of run(MyOperation), how can I tell which step of the operation failed?

If the result object doesn't contain this info by default, what's a good way to add it?

Simon Jakobi
  • 117
  • 6

1 Answers1

2

There is this gem now which provides operation specific debugging utilities - https://github.com/trailblazer/trailblazer-developer

It allows you to see exactly which step raised the exception or which step caused the track to change from success to failure.

Trailblazer::Developer.wtf?(MyOperation, options)

It will print the trace of steps on STDOUT/Logger.

enter image description here

Yogesh Khater
  • 1,690
  • 1
  • 15
  • 20