-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce MaintenanceTasks::Task.rescue_from
By default any errors encountered while processing an iteration will be raised and 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. ```ruby module Maintenance class UpdatePostRescueErrorTask < MaintenanceTasks::Task rescue_from ActiveRecord::RecordNotUnique end end ``` Or you can pass a custom handler with a block. ```ruby module Maintenance class UpdatePostRescueErrorTask < MaintenanceTasks::Task rescue_from ActiveRecord::RecordNotUnique do |error| CustomErrorHandler.report(error) end end end ``` Co-authored-by: Adrianna Chang <[email protected]>
- Loading branch information
1 parent
14c7c69
commit 665666b
Showing
5 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters