Closed matthucke closed 7 years ago
Are you using the class method call
or the instance method?
Neither. I was testing internal business-logic methods of my interactor directly - before writing a call
that would combine them in sequence.
Reading the source, I discover that call
swallows exceptions from fail!
, while call!
does not.
I'll submit a modification to the README that clarifies this.
[edit] Pull request #91 submitted.
Merged #91.
In Version 3, context.fail! always throws an exception:
In version 2, it did not. The README is still showing the version 2 behaviour, where the caller queries success? after.
What is the current best practice to indicate and respond to failure? I liked the old idiom of checking context.success? from the controller, after the interactor has returned. Yet now it seems we must rescue instead - a change that disrupts the structure of the controller methods.
Could we provide a non-throwing 'fail' method in addition to the throwing version? (I'm currently using a Rails initializer to monkey-patch one in).