Skip to content

Commit

Permalink
fix: add exceptionhandling for work deleteion like collection task
Browse files Browse the repository at this point in the history
  • Loading branch information
pghorpade committed Jan 12, 2024
1 parent deb36fd commit b564f18
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/tasks/delete.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

namespace :californica do
task delete_work: [:environment] do
Californica::Deleter.new(id: ENV.fetch('DELETE_WORK_ID')).delete_with_children
begin
deletion_successful = Californica::Deleter.new(id: ENV.fetch('DELETE_WORK_ID')).delete_with_children
puts deletion_successful ? 'Deletion completed successfully!' : 'Deletion skipped for some items.'
rescue => e
puts "An error occurred: #{e.message}"
end

puts('Done!')
end

Expand Down

0 comments on commit b564f18

Please sign in to comment.