-
Notifications
You must be signed in to change notification settings - Fork 77
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
Introduce MaintenanceTasks::Task.rescue_from #1150
base: main
Are you sure you want to change the base?
Conversation
0d540de
to
98aa21c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this feature.
I'd like to do this just be including |
665666b
to
8cdc2db
Compare
@kmcphillips I added support for 6.1 (and tested it locally) but ci just seems broken for 6.1 🤔 So maybe we should just remove it. |
README.md
Outdated
the task with error. Errors can be rescued using the `rescue_from` handler. Errors | ||
rescued this way will be reported by the handler and iteration will continue. | ||
|
||
The default handler just calls `Rails.error.report` with the raised error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default handler just calls `Rails.error.report` with the raised error. | |
The default handler calls `Rails.error.report` with the raised error: |
8cdc2db
to
a79137a
Compare
MaintenanceTasks::Task.report_on takes a list of exceptions. When the task is iterating those exceptions will be rescued and reported to the error reporter, then iteration will continue.
a79137a
to
6a95c12
Compare
After some discussion, I am going to use For consistency's sake, I deprecated the |
By default any errors encountered while processing an iteration will be raised and the task with error. In our app we noticed a lot developers writing very similar code to rescue some exceptions, report them and moving on to the next iteration. So, let's introduce a helper to make this easier.
We introduced a
report_on
method toMaintenancneTask::Tasks
. Exceptions passed to this method will be rescued during iteration and reported the rails error reporter, then iteration will continue.