Related to pragmarb/pragma-operation#2.
This pattern is very annoying:
options['result.response'] = Pragma::Operation::Response::NotFound
.new
.decorate_with(Pragma::Decorator::Error)
There is no reason for that decorate_with to exist, it's just boilerplate.
If result.response is a Pragma error response and it's not decorated, we should decorate it with Pragma::Decorator::Error automatically.
We either do it in pragma-operation or decorate the base operation here, e.g.
class Pragma::Operation::Base < Trailblazer::Operation
def call(*)
result = super
result['result.response'] = '...'
end
end
The problem with this is it cannot be overridden since it's not a step, and there is no way to ensure a step is actually run at the end of the operation.
Related to pragmarb/pragma-operation#2.
This pattern is very annoying:
There is no reason for that
decorate_withto exist, it's just boilerplate.If
result.responseis a Pragma error response and it's not decorated, we should decorate it withPragma::Decorator::Errorautomatically.We either do it in
pragma-operationor decorate the base operation here, e.g.The problem with this is it cannot be overridden since it's not a step, and there is no way to ensure a step is actually run at the end of the operation.