Skip to content
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

Archival exceptions should not be swallowed during testing #50

Open
esquivalient opened this issue Jun 22, 2022 · 1 comment
Open

Archival exceptions should not be swallowed during testing #50

esquivalient opened this issue Jun 22, 2022 · 1 comment

Comments

@esquivalient
Copy link
Member

The current implementation of #handle_archival_action_exception translates all exceptions to an ActiveRecord::Rollback exception. If archiving fails because of an exception, the only information return is 'false'. There are some log lines in that method that look like they intend to provide more information, but those log messages were not added to the test log in a recent Rails 7 project.

I think this situation can be replicated by making a model with a bogus relationship, like

class Foo < ApplicationRecord
  acts_as_archival
  has_many :bar
end

where the project does not have a Bar model. So, calling archive on an instance of Foo like

test = Foo.first
test.archive! #=> false

Debugging in the run_callbacks will show the failure is about failing to find the Bar class.

@lbernick
Copy link

Related: It looks like these exceptions are logged at debug level. A higher log level seems appropriate here-- at least info if not error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants