From 44e144cecc2685e8ee8ffc9f18f28f06a7e069ac Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 27 Dec 2022 22:41:07 +0100 Subject: [PATCH] Appease the dog overlords --- app/workers/share_worker.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/workers/share_worker.rb b/app/workers/share_worker.rb index 60e314b1..b61e90c7 100644 --- a/app/workers/share_worker.rb +++ b/app/workers/share_worker.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ShareWorker include Sidekiq::Worker @@ -14,19 +16,19 @@ class ShareWorker rescue ActiveRecord::RecordNotFound logger.info "Tried to post answer ##{answer_id} for user ##{user_id} to #{service.titleize} but the user/answer/service did not exist (likely deleted), will not retry." # The question to be posted was deleted - return + nil rescue Twitter::Error::DuplicateStatus logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the status was already posted." - return + nil rescue Twitter::Error::Forbidden # User's Twitter account is suspended logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the account is suspended." - return + nil rescue Twitter::Error::Unauthorized # User's Twitter token has expired or been revoked # TODO: Notify user if this happens (https://github.com/Retrospring/retrospring/issues/123) logger.info "Tried to post answer ##{answer_id} from user ##{user_id} to Twitter but the token has exired or been revoked." - return + nil rescue => e logger.info "failed to post answer #{answer_id} to #{service} for user #{user_id}: #{e.message}" Sentry.capture_exception(e)