pragmarb/pragma

Indicate where an operation has halted

aldesantis opened this issue · 1 comments

It would be nice to have a way to see what was the last step executed by an operation, so that we can easily understand what is halting an operation.

We could set the last executed step on the operation's skill, e.g.

result = Api::V2::User::Operation::Show.call('id' => 1)
result['result.last_step'] # => "model.find_by"
result['result.failing_step'] # => "policy.default"

result.failing_step here can be computed like this (here be dragons):

steps = Api::V2::User::Operation::Show.skills['pipetree'].instance_variable_get('@index').keys
steps[steps.index(result['result.last_step']) + 1]

This should also be indicated in Pragma::Rails::NoResponseError.