New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If some of the interactors of the organizer fail error message is not persisted. #169
Comments
@majksner can you provide a minimal reproduction case with the interactors and organizers included? |
Create directory test.rb module TestInteractor
class Test < ApplicationOrganizer
organize do
add TestInteractor::Prepare
end
end
end prepare.rb module TestInteractor
class Prepare < ApplicationInteractor
def perform
context.fail!('Something Went Wrong')
end
end
end then open Rails console [6] pry(main)> result = TestInteractor::Test.perform()
[8] pry(main)> result.success?
=> false
[9] pry(main)> result.errors
=> #<ActiveModel::Errors:0x00007ffa88328180 @base=#<TestInteractor::Test::Context>, @details={}, @messages={}> messages are empty here, I expect to see an error message from the interactor Then running Interactor directly without involving an organizer provides an error message. [10] pry(main)> result = TestInteractor::Prepare.perform()
ActiveInteractor: TestInteractor::Prepare::Context failed!
=> #<TestInteractor::Prepare::Context>
[11] pry(main)> result.errors
=> #<ActiveModel::Errors:0x00007ffa88389138 @base=#<TestInteractor::Prepare::Context>, @details={:context=>[{:error=>"Something Went Wrong"}]}, @messages={:context=>["Something Went Wrong"]}> |
Research notes: This is happening because we run a validation check after |
If some of the interactors of the organizer fail
context.fail!('Error Message')
error message is not persisted.Initially reported in #167
The text was updated successfully, but these errors were encountered: